cmd/resaw.py

22 lines
453 B
Python
Raw Normal View History

2019-12-10 21:01:56 +00:00
'''
Used for executing slight variations on the same command.
usage:
resaw command arg1 arg2 {x} arg3
then x will be inputted from stdin every time.
The curly braces are required literally.
'''
import subprocess
import sys
if len(sys.argv) < 2:
raise ValueError()
COMMAND = ' '.join('"%s"' % arg for arg in sys.argv[1:])
while True:
x = input(':')
command = COMMAND.format(x=x)
print(command)
subprocess.run(command, shell=True)