This lets other tools import equery and call the main func with its own
set of flags.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Paul Varner <fuzzyray@gentoo.org>
from gentoolkit import equery, errors
try:
- equery.main()
+ equery.main(sys.argv)
except errors.GentoolkitNonZeroExit as err:
sys.exit(err.return_code)
except errors.GentoolkitException as err:
return args.pop(0), args
-def main():
+def main(argv):
"""Parse input and run the program."""
short_opts = "hqCNV"
initialize_configuration()
try:
- global_opts, args = getopt(sys.argv[1:], short_opts, long_opts)
+ global_opts, args = getopt(argv[1:], short_opts, long_opts)
except GetoptError as err:
sys.stderr.write(pp.error("Global %s" % err))
print_help(with_description=False)
raise
if __name__ == '__main__':
- main()
+ main(sys.argv)