Exemplo n.º 1
0
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:
    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:
Exemplo n.º 2
0
    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)

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