dnf-json: read arguments as JSON from stdin

This allows us to have more expressive input arguments.
This commit is contained in:
Lars Karlitski 2019-11-03 17:48:39 +01:00 committed by Tom Gundersen
parent 0feb4e4d44
commit cae1fdd04d
2 changed files with 28 additions and 14 deletions

View file

@ -11,16 +11,9 @@ def timestamp_to_rfc3339(timestamp):
return d.strftime('%Y-%m-%dT%H:%M:%SZ')
# base.sack.query().filter(provides=str(reldep))
try:
command = sys.argv[1]
arguments = sys.argv[2:]
except IndexError:
command = "list"
arguments = []
call = json.load(sys.stdin)
command = call["command"]
arguments = call.get("arguments", {})
base = dnf.Base()