Added syscmd.py

This commit is contained in:
James Booth
2016-02-29 23:12:46 +00:00
parent 3134b8da83
commit b67dfb2951
2 changed files with 20 additions and 0 deletions

View File

@@ -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/.

19
syscmd.py Normal file
View File

@@ -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 <command>" ]
description = "Run a system command."
args = [
[ "<command>", "The command" ]
]
examples = [
"/system \"ls -l\""
]
prof.register_command("/system", 1, 1, synopsis, description, args, examples, _cmd_system)