diff options
author | volpino <fox91@anche.no> | 2012-05-23 16:30:43 +0200 |
---|---|---|
committer | volpino <fox91@anche.no> | 2012-05-23 16:30:43 +0200 |
commit | a18083bd988213251fd1e5a2ee1e94c8512e56cb (patch) | |
tree | 1e2bd80dc946f8fa8bf720dc49fa35ed34130085 /bin | |
parent | euscan: adding json output (diff) | |
download | euscan-a18083bd988213251fd1e5a2ee1e94c8512e56cb.tar.gz euscan-a18083bd988213251fd1e5a2ee1e94c8512e56cb.tar.bz2 euscan-a18083bd988213251fd1e5a2ee1e94c8512e56cb.zip |
euscan: json format output
Now "-f json" seems good, it supports the handler type used to retrieve
each version and outputs metadata.
Signed-off-by: volpino <fox91@anche.no>
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/euscan | 31 |
1 files changed, 18 insertions, 13 deletions
@@ -212,7 +212,7 @@ def main(): # parse command line options and actions try: - packages = parse_args() + queries = parse_args() except ParseArgsException as e: if e.value == 'help': print_usage(help='all') @@ -233,11 +233,13 @@ def main(): if CONFIG['verbose'] > 2: httplib.HTTPConnection.debuglevel = 1 - for package in packages: + for query in queries: ret = [] + output.set_query(query) + try: - ret = scan_upstream(package) + ret = scan_upstream(query) except AmbiguousPackageName as e: pkgs = e.args[0] output.eerror("\n".join(pkgs)) @@ -252,24 +254,27 @@ def main(): exit_helper(1) except GentoolkitException as err: - output.eerror('%s: %s' % (package, str(err))) + output.eerror('%s: %s' % (query, str(err))) exit_helper(1) except Exception as err: - output.eerror('%s: %s' % (package, str(err))) + output.eerror('%s: %s' % (query, str(err))) exit_helper(1) if not CONFIG['quiet'] and not CONFIG['format']: print() - for cp, url, version in ret: - output.result(cp, version, url) - - if not len(ret) and not CONFIG['quiet']: - output.ewarn( - "Didn't find any new version, check package's homepage for " + - "more informations" - ) + if ret is not None: + if len(ret) > 0: + for cp, url, version, handler in ret: + output.result(cp, version, url, handler) + elif not CONFIG['quiet']: + output.ewarn( + "Didn't find any new version, check package's homepage " + + "for more informations" + ) + + output.set_query(None) if __name__ == "__main__": |