def main(argv=sys.argv): """ """ parser = argparse.ArgumentParser( description="Generates a SDK according from a specification set") parser.add_argument( "-b", "--branches", dest="branches", metavar="branches", help= "The branches of the specifications to use to generate the documentation (examples: \"master 3.2\")", nargs="*", type=str) parser.add_argument( "-f", "--folder", dest="folder", metavar="folder", required=True, help= "Path of the specifications folder. If set, all other attributes will be ignored", type=str) parser.add_argument("-c", "--config", dest="config_path", metavar="config_path", help="Path the monolithe configuration file", type=str) parser.add_argument( "--vanilla-prefix", dest="vanilla_prefix", help= "Prefix added to all vanilla path declared in the monolithe configuration file", required=False, type=str) parser.add_argument( "--generation-version", dest="generation_version", help="Overwrite the sdk version given in monolithe.conf", required=False, type=str) parser.add_argument( "-L", "--language", dest="language", help="Choose the output language of the SDK. Default is python", default='python', type=str) args = parser.parse_args() if args.branches: directory_manager = RepositoryManager(args.folder, config_path=args.config_path) else: directory_manager = FolderManager(args.folder, config_path=args.config_path) monolithe_config = directory_manager.monolithe_config if monolithe_config and args.vanilla_prefix: monolithe_config.set_option( "user_vanilla", "%s/%s" % (args.vanilla_prefix, monolithe_config.get_option("user_vanilla", "transformer")), "transformer") if monolithe_config and args.generation_version: monolithe_config.set_option("version", args.generation_version, "transformer") if monolithe_config: monolithe_config.language = args.language generator = SDKGenerator(directory_manager, args.branches) generator.run(args.branches)