Add resaw.py
This commit is contained in:
parent
8d4e353c66
commit
cba1d51587
1 changed files with 21 additions and 0 deletions
21
resaw.py
Normal file
21
resaw.py
Normal 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)
|
Loading…
Reference in a new issue