Tweak script and print helpers
This commit is contained in:
parent
2997686d70
commit
10b9e273e7
2 changed files with 39 additions and 9 deletions
15
lib.py
15
lib.py
|
|
@ -1,9 +1,16 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import subprocess
|
||||
from subprocess import run, PIPE
|
||||
|
||||
def echo (bstr):
|
||||
print (bstr.decode(), end='')
|
||||
|
||||
def script (*args):
|
||||
p = subprocess.run (('./script.sh',) + args, stdout=subprocess.PIPE)
|
||||
p = p.stdout.split (b'\n')
|
||||
del p[-1]
|
||||
p = run (('./script.sh',) + args, stdout=PIPE)
|
||||
p = p.stdout
|
||||
return p
|
||||
|
||||
def script_lines (*args):
|
||||
p = script (args)
|
||||
p = p.split (b'\n')
|
||||
return p
|
||||
|
|
|
|||
33
query.py
33
query.py
|
|
@ -1,8 +1,31 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import lib
|
||||
from sys import argv
|
||||
from lib import echo, script
|
||||
|
||||
p = lib.script ('list-tags')
|
||||
p = b'\n'.join (p)
|
||||
p = p.decode()
|
||||
print (p)
|
||||
cmd = argv[1]
|
||||
|
||||
if cmd == 'versions':
|
||||
p = script ('list-tags')
|
||||
echo (p)
|
||||
|
||||
elif cmd == 'dir':
|
||||
version = argv[2]
|
||||
path = argv[3]
|
||||
p = script ('get-dir', version, path)
|
||||
echo (p)
|
||||
|
||||
elif cmd == 'source':
|
||||
version = argv[2]
|
||||
path = argv[3]
|
||||
|
||||
pass
|
||||
|
||||
elif cmd == 'ident':
|
||||
version = argv[2]
|
||||
ident = argv[3]
|
||||
|
||||
pass
|
||||
|
||||
else:
|
||||
print (argv[0] + ': Unknown subcommand: ' + cmd)
|
||||
|
|
|
|||
Loading…
Reference in a new issue