mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
JSON printing argument
This commit is contained in:
parent
0b85eccce9
commit
3114ea9aaf
1 changed files with 4 additions and 1 deletions
|
@ -175,6 +175,9 @@ def main():
|
|||
admin_password = sys.argv[key+1]
|
||||
sys.argv.pop(key)
|
||||
sys.argv.pop(key)
|
||||
if arg == '--json':
|
||||
json_print = True
|
||||
sys.argv.pop(key)
|
||||
|
||||
try:
|
||||
args = parse_dict(action_map)
|
||||
|
@ -201,7 +204,7 @@ def main():
|
|||
else:
|
||||
if result is None:
|
||||
pass
|
||||
elif os.isatty(1):
|
||||
elif os.isatty(1) and not json_print:
|
||||
pretty_print_dict(result)
|
||||
else:
|
||||
print(json.dumps(result))
|
||||
|
|
Loading…
Add table
Reference in a new issue