From b67dfb2951d7ba1f43837547003bd876f3024a38 Mon Sep 17 00:00:00 2001 From: James Booth Date: Mon, 29 Feb 2016 23:12:46 +0000 Subject: [PATCH] Added syscmd.py --- copy-all-stable.sh | 1 + syscmd.py | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 syscmd.py diff --git a/copy-all-stable.sh b/copy-all-stable.sh index 2c54f10..a7d56c6 100755 --- a/copy-all-stable.sh +++ b/copy-all-stable.sh @@ -1,6 +1,7 @@ rm -rf ~/.local/share/profanity/plugins/* cp ascii.py ~/.local/share/profanity/plugins/. +cp syscmd.py ~/.local/share/profanity/plugins/. cp browser.py ~/.local/share/profanity/plugins/. cp platform-info.py ~/.local/share/profanity/plugins/. cp say.py ~/.local/share/profanity/plugins/. diff --git a/syscmd.py b/syscmd.py new file mode 100644 index 0000000..42f7e33 --- /dev/null +++ b/syscmd.py @@ -0,0 +1,19 @@ +import prof +import subprocess + +def _cmd_system(text): + result = subprocess.Popen(text, shell=True, stdout=subprocess.PIPE).stdout.read() + split = result.splitlines() + for s in split: + prof.cons_show(s) + +def prof_init(version, status): + synopsis = [ "/system " ] + description = "Run a system command." + args = [ + [ "", "The command" ] + ] + examples = [ + "/system \"ls -l\"" + ] + prof.register_command("/system", 1, 1, synopsis, description, args, examples, _cmd_system)