当前位置: 首页>>代码示例>>Python>>正文


Python ArghParser.set_default_command方法代码示例

本文整理汇总了Python中argh.ArghParser.set_default_command方法的典型用法代码示例。如果您正苦于以下问题:Python ArghParser.set_default_command方法的具体用法?Python ArghParser.set_default_command怎么用?Python ArghParser.set_default_command使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在argh.ArghParser的用法示例。


在下文中一共展示了ArghParser.set_default_command方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: eventparser_entry

# 需要导入模块: from argh import ArghParser [as 别名]
# 或者: from argh.ArghParser import set_default_command [as 别名]
def eventparser_entry():
    parser = ArghParser(parents=[COMMON_PARSER])
    parser.set_default_command(eventparser)
    completion.autocomplete(parser)

    # Parse ahead
    args = parser.parse_args()
    if args.debug:
        logging.basicConfig(
            level=logging.DEBUG,
            format='%(asctime)s %(levelname)s: %(message)s'
        )

    parser.dispatch()
开发者ID:nithinphilips,项目名称:axiom,代码行数:16,代码来源:axiom.py

示例2: main

# 需要导入模块: from argh import ArghParser [as 别名]
# 或者: from argh.ArghParser import set_default_command [as 别名]
def main():  # pragma: no cover
    '''Console entry point.

    Constructs and dispatches the argument parser.
    '''
    parser = ArghParser(prog='pageit', description=pageit.__doc__,
                        epilog=pageit.__epilog__)
    parser.add_argument('--version', action='version',
                        version='%(prog)s ' + pageit.__version__)
    parser.add_argument('-v', '--verbose', dest='verbosity', action='count',
                        default=1, help='show logging messages')
    parser.add_argument('-q', '--quiet', dest='verbosity',
                        action='store_const', const=0,
                        help='suppress logging messages')
    parser.set_default_command(render)
    parser.dispatch()
开发者ID:metaist,项目名称:pageit,代码行数:18,代码来源:render.py

示例3: zsmc_main

# 需要导入模块: from argh import ArghParser [as 别名]
# 或者: from argh.ArghParser import set_default_command [as 别名]
def zsmc_main():
    parser = ArghParser(formatter_class=argparse.RawDescriptionHelpFormatter)
    parser.set_default_command(start)
    parser.dispatch()
开发者ID:itnihao,项目名称:zbxmon,代码行数:6,代码来源:script.py

示例4: _raw_input

# 需要导入模块: from argh import ArghParser [as 别名]
# 或者: from argh.ArghParser import set_default_command [as 别名]
    username = _raw_input("Username: ")
    password = getpass("Password: ")

    gh.login(username, password, scopes=scopes, comment=comment)


@arg("-s", "--scope", default=None, action="append", help="GitHub auth scopes to request")
@arg("-c", "--comment", help="Comment to attach to the auth token request")
@arg("github", nargs="?", help='GitHub instance nickname (e.g "enterprise")')
def login(args):
    """
    Log into a GitHub instance, and print the resulting OAuth token.
    """
    with cli.catch_api_errors():
        client = GithubAPIClient(nickname=args.github)
        login_if_needed(client, args.scope, comment=args.comment)

        oauth_token_key = envkey(client.nickname, "oauth_token")
        print("export {0}='{1}'".format(oauth_token_key, client.token))


parser.set_default_command(login)


def main():
    parser.dispatch()


if __name__ == "__main__":
    main()
开发者ID:alphagov,项目名称:ghtools,代码行数:32,代码来源:login.py

示例5: command

# 需要导入模块: from argh import ArghParser [as 别名]
# 或者: from argh.ArghParser import set_default_command [as 别名]
def command():
    # http://argh.readthedocs.org/en/latest/
    parser = ArghParser(description=__doc__)
    parser.set_default_command(reorder_po)
    parser.dispatch()
开发者ID:chronossc,项目名称:bag,代码行数:7,代码来源:reorder_po.py

示例6: status

# 需要导入模块: from argh import ArghParser [as 别名]
# 或者: from argh.ArghParser import set_default_command [as 别名]
@arg('-c', '--context', help='Label to differentiate this status from the status of other systems')
def status(args):
    """
    Set build status for a commit on GitHub
    """
    repo = Repo(args.repo)

    payload = {'state': args.state}

    if args.description is not None:
        payload['description'] = args.description

    if args.url is not None:
        payload['target_url'] = args.url

    if args.context is not None:
        payload['context'] = args.context

    with cli.catch_api_errors():
        res = repo.set_build_status(args.sha, payload)

    print(json.dumps(res.json(), indent=2))
parser.set_default_command(status)


def main():
    parser.dispatch()

if __name__ == '__main__':
    main()
开发者ID:alphagov,项目名称:ghtools,代码行数:32,代码来源:status.py

示例7: main

# 需要导入模块: from argh import ArghParser [as 别名]
# 或者: from argh.ArghParser import set_default_command [as 别名]
def main():
    p = ArghParser()
    p.set_default_command(remux)
    p.dispatch()
开发者ID:mfussenegger,项目名称:dotfiles,代码行数:6,代码来源:remux.py

示例8: nickname

# 需要导入模块: from argh import ArghParser [as 别名]
# 或者: from argh.ArghParser import set_default_command [as 别名]
@arg('github', nargs='?', help='GitHub instance nickname (e.g "enterprise")')
@arg('url', help='URL to browse')
@arg('-m', '--method', default='get', choices=('get', 'delete'), help='HTTP method to use.')
def browse(args):
    """
    Print the GitHub API response at the given URL
    """
    with cli.catch_api_errors():
        client = GithubAPIClient(nickname=args.github)
        res = client.request(args.method, args.url, _raise=False)

        print('HTTP/1.1 {0} {1}'.format(res.status_code, res.reason))

        for k, v in res.headers.items():
            print("{0}: {1}".format(k, v))

        print()
        if res.json() is not None:
            print(json.dumps(res.json(), indent=2))
        else:
            print(res.content)
parser.set_default_command(browse)


def main():
    parser.dispatch()

if __name__ == '__main__':
    main()
开发者ID:alphagov,项目名称:ghtools,代码行数:31,代码来源:browse.py


注:本文中的argh.ArghParser.set_default_command方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。