def set_globals_cmds(sub_cmds): for cmd in sub_cmds: if hasattr(sub_cmds[cmd], 'set_globals'): sub_cmds[cmd].set_globals(api, username, password) if hasattr(sub_cmds[cmd], 'subCmds'): set_globals_cmds(sub_cmds[cmd].subCmds) # Generate marketplacecli base command + help base command CmdBuilder.generateCommands(Mycli) app = Mycli() myactions = generate_base_doc(app, help="") # Args parsing mainParser = CoreArgumentParser(add_help=False) CoreArgumentParser.actions = myactions mainParser.add_argument('-a', '--url', dest='url', type=str, help='the server URL endpoint to use', required=False) mainParser.add_argument('-u', '--user', dest='user', type=str, help='the user name used to authenticate to the server', required=False) mainParser.add_argument('-p', '--password', dest='password', type=str, help='the password used to authenticate to the server', required=False) mainParser.add_argument('-v', action='version', help='displays the current version of the marketplacecli tool', version="%(prog)s version '" + constants.VERSION + "'") mainParser.add_argument('-h', '--help', dest='help', action='store_true', help='show this help message and exit', required=False) mainParser.set_defaults(help=False) mainParser.add_argument('cmds', nargs='*', help='Marketplace CLI cmds') mainArgs, unknown = mainParser.parse_known_args() if mainArgs.help and not mainArgs.cmds:
credfile_yaml = hammr_utils.get_hammr_dir() + os.sep + "credentials.yml" if os.path.isfile(credfile_yaml): return credfile_yaml credfile_json = hammr_utils.get_hammr_dir() + os.sep + "credentials.json" if os.path.isfile(credfile_json): return credfile_json return None #Generate hammr base command + help base command CmdBuilder.generateCommands(Hammr) app = Hammr() myactions = generate_base_doc(app, hamm_help="") # Args parsing mainParser = CoreArgumentParser(add_help=False) CoreArgumentParser.actions = myactions mainParser.add_argument('-a', '--url', dest='url', type=str, help='the UForge server URL endpoint to use', required=False) mainParser.add_argument( '-u', '--user', dest='user', type=str, help='the user name used to authenticate to the UForge server', required=False) mainParser.add_argument(
def set_globals_cmds(subCmds): for cmd in subCmds: if hasattr(subCmds[cmd], 'set_globals'): subCmds[cmd].set_globals(api) if hasattr(subCmds[cmd], 'subCmds'): set_globals_cmds(subCmds[cmd].subCmds) #Generate Uforgecli base command + help base command CmdBuilder.generateCommands(Uforgecli) app = Uforgecli() myactions=generate_base_doc(app, uforgecli_help="") # Args parsing mainParser = CoreArgumentParser(add_help=False) CoreArgumentParser.actions=myactions mainParser.add_argument('-U', '--url', dest='url', type=str, help='the server URL endpoint to use', required = False) mainParser.add_argument('-u', '--user', dest='user', type=str, help='the user name used to authenticate to the server', required = False) mainParser.add_argument('-p', '--password', dest='password', type=str, help='the password used to authenticate to the server', required = False) mainParser.add_argument('-v', action='version', help='displays the current version of the uforge-cli tool', version="%(prog)s version '"+constants.VERSION+"'") mainParser.add_argument('-h', '--help', dest='help', action='store_true', help='show this help message and exit', required = False) mainParser.add_argument('-k', '--publickey', dest='publickey', type=str, help='public API key to use for this request. Default: no default', required = False) mainParser.add_argument('-s', '--secretkey', dest='secretkey', type=str, help='secret API key to use for this request. Default: no default', required = False) mainParser.add_argument('-c', '--no-check-certificate', dest='crypt', action="store_true", help='Don\'t check the server certificate against the available certificate authorities', required = False) mainParser.set_defaults(help=False) mainParser.add_argument('cmds', nargs='*', help='UForge CLI cmds') mainArgs, unknown = mainParser.parse_known_args()
printer.out("Checking default credentials file...", printer.INFO) credfile_yaml=hammr_utils.get_hammr_dir()+os.sep+"credentials.yml" if os.path.isfile(credfile_yaml): return credfile_yaml credfile_json=hammr_utils.get_hammr_dir()+os.sep+"credentials.json" if os.path.isfile(credfile_json): return credfile_json return None #Generate hammr base command + help base command CmdBuilder.generateCommands(Hammr) app = Hammr() myactions=generate_base_doc(app, hamm_help="") # Args parsing mainParser = CoreArgumentParser(add_help=False) CoreArgumentParser.actions=myactions mainParser.add_argument('-a', '--url', dest='url', type=str, help='the UForge server URL endpoint to use', required = False) mainParser.add_argument('-u', '--user', dest='user', type=str, help='the user name used to authenticate to the UForge server', required = False) mainParser.add_argument('-p', '--password', dest='password', type=str, help='the password used to authenticate to the UForge server', required = False) mainParser.add_argument('-c', '--credentials', dest='credentials', type=str, help='the credential file used to authenticate to the UForge server (default to ~/.hammr/credentials.yml or ~/.hammr/credentials.json)', required = False) mainParser.add_argument('-v', action='version', help='displays the current version of the hammr tool', version="%(prog)s version '"+constants.VERSION+"'") mainParser.add_argument('-h', '--help', dest='help', action='store_true', help='show this help message and exit', required = False) mainParser.set_defaults(help=False) mainParser.add_argument('cmds', nargs='*', help='Hammr cmds') mainArgs, unknown = mainParser.parse_known_args() if mainArgs.help and not mainArgs.cmds: mainParser.print_help() exit(0)
def set_globals_cmds(subCmds): for cmd in subCmds: if hasattr(subCmds[cmd], 'set_globals'): subCmds[cmd].set_globals(api) if hasattr(subCmds[cmd], 'subCmds'): set_globals_cmds(subCmds[cmd].subCmds) #Generate Uforgecli base command + help base command CmdBuilder.generateCommands(Uforgecli) app = Uforgecli() myactions = generate_base_doc(app, uforgecli_help="") # Args parsing mainParser = CoreArgumentParser(add_help=False) CoreArgumentParser.actions = myactions mainParser.add_argument('-U', '--url', dest='url', type=str, help='the server URL endpoint to use', required=False) mainParser.add_argument( '-u', '--user', dest='user', type=str, help='the user name used to authenticate to the server', required=False) mainParser.add_argument('-p',