From 40ef42a24637eaae7bf56db12333a5cd1c612b49 Mon Sep 17 00:00:00 2001 From: Deven Blake Date: Sun, 30 May 2021 17:25:45 -0400 Subject: [PATCH] execute external commands --- it/!.py | 11 +++++++++++ it/README.md | 4 ++++ 2 files changed, 15 insertions(+) create mode 100644 it/!.py diff --git a/it/!.py b/it/!.py new file mode 100644 index 0000000..29cdb9a --- /dev/null +++ b/it/!.py @@ -0,0 +1,11 @@ +import subprocess + +def main(buffer, command): + if len(command) == 1: + print("?") + else: + try: + print("[%d]" % subprocess.run(command[1:]).returncode) + except Exception as err: + print("%s" % str(err)) + return buffer diff --git a/it/README.md b/it/README.md index aa84489..00047c1 100644 --- a/it/README.md +++ b/it/README.md @@ -9,6 +9,10 @@ For disambiguation it's suggested that this project be referred to as "ited", pr ## Included commands +### ! + +Passes arguments to Python `subprocess.run`. + ### buffer This is where code relating to the Buffer class is kept but calling this from within the editor will allow you to view the current buffer's attributes.