|
|
|
@ -9,6 +9,10 @@ parser.add_argument('-c',
|
|
|
|
|
action='store',
|
|
|
|
|
help='Command to execute.',
|
|
|
|
|
default='')
|
|
|
|
|
parser.add_argument('--insert',
|
|
|
|
|
action='store_true',
|
|
|
|
|
help='Type output into current tab?',
|
|
|
|
|
default=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@userscript
|
|
|
|
@ -17,8 +21,13 @@ def shell_command(request):
|
|
|
|
|
if not args.c:
|
|
|
|
|
request.send_text("Please specify a command: {} -c'uname -a' ".format(request.script_name))
|
|
|
|
|
return
|
|
|
|
|
r = subprocess.check_output(args=args.c.split(' '))
|
|
|
|
|
request.send_text(r)
|
|
|
|
|
r = subprocess.check_output(args=args.c, shell=True)
|
|
|
|
|
text = str(r, 'utf-8').strip()
|
|
|
|
|
if args.insert:
|
|
|
|
|
request.send_command('insert-text {}'.format(text))
|
|
|
|
|
# request.send_text(text)
|
|
|
|
|
else:
|
|
|
|
|
request.send_text(text)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|