def main(): """Parse command line arguments, instantiate graph and dump image""" parser = argparse.ArgumentParser() parser.add_argument("packages", help="Full path to a package in the Nix store. " "This package will be diagrammed", nargs='+') parser.add_argument("--configfile", "-c", help="ini file with layout and " "style configuration", required=False) parser.add_argument("--configsection", "-s", help="section from ini file " "to read") parser.add_argument("--output", "-o", help="output filename, will be " "a png", default="frame.png", required=False) parser.add_argument('--verbose', dest='verbose', action='store_true') parser.add_argument('--no-verbose', dest='verbose', action='store_false') parser.set_defaults(verbose=False) args = parser.parse_args() init_logger(debug=args.verbose) try: graph = Graph(args.packages, (args.configfile, args.configsection), args.output) except util.TreeCLIError as e: sys.stderr.write("ERROR: {}\n".format(e.message)) sys.exit(1) if __name__ == "__main__": main()