diff --git a/bin/yunohost b/bin/yunohost index d73241c13..77814aea5 100755 --- a/bin/yunohost +++ b/bin/yunohost @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- import sys -import os.path +import os from_source = False @@ -23,10 +23,18 @@ if __name__ == '__main__': init(_from_source=from_source) # Additional arguments - use_cache = True + cache = True + json = False if '--no-cache' in sys.argv: - use_cache = False + cache = False sys.argv.remove('--no-cache') + if '--json' in sys.argv: + json = True + sys.argv.remove('--json') + + ## Compatibility with previous moulinette + if not os.isatty(1): + json = True args = list(sys.argv) args.pop(0) @@ -46,5 +54,5 @@ if __name__ == '__main__': sys.exit(1) # Execute the action - ret = cli(['yunohost'], args, use_cache) + ret = cli(['yunohost'], args, print_json=json, use_cache=cache) sys.exit(ret)