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: mainParser.print_help() exit(0) if mainArgs.user is not None and mainArgs.url is not None: if not mainArgs.password: mainArgs.password = getpass.getpass() username = mainArgs.user password = mainArgs.password url = mainArgs.url sslAutosigned = True else: mainParser.print_help() exit(0) # UForge API instanciation client = httplib2.Http(disable_ssl_certificate_validation=sslAutosigned, timeout=constants.HTTP_TIMEOUT)
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) if mainArgs.url is not None: url = mainArgs.url if mainArgs.user is not None: if not mainArgs.password: mainArgs.password = getpass.getpass() username = mainArgs.user password = mainArgs.password sslAutosigned = True else: if mainArgs.credentials is not None: credfile = mainArgs.credentials credpath = check_credfile(credfile)