Add resaw.py

This commit is contained in:
voussoir 2019-12-10 13:01:56 -08:00
parent 8d4e353c66
commit cba1d51587

21
resaw.py Normal file
View file

@ -0,0 +1,21 @@
'''
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)