main.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:discogs-cli 作者: jesseward 项目源码 文件源码
def cli():
    history = InMemoryHistory()
    style = style_from_pygments(get_style_by_name('monokai'))
    lexer = PygmentsLexer(DiscogsCliLexer)
    completer = Completer(fuzzy_match=False, text_utils=TextUtils())

    SYNTAX = 'Syntax: ogs <command> [options]'

    click.secho('     _ _                                    _ _ ',
                fg='yellow')
    click.secho('  __| (_)___  ___ ___   __ _ ___        ___| (_)',
                fg='yellow')
    click.secho(' / _` | / __|/ __/ _ \ / _` / __|_____ / __| | |',
                fg='yellow')
    click.secho('| (_| | \__ \ (_| (_) | (_| \__ \_____| (__| | |',
                fg='yellow')
    click.secho(' \__,_|_|___/\___\___/ \__, |___/      \___|_|_|',
                fg='yellow')
    click.secho('                       |___/', fg='yellow')

    click.echo('Version:' + __version__)
    click.echo(SYNTAX)

    while True:

        try:
            text = prompt('discogs-cli >>> ', style=style, history=history,
                          lexer=lexer, completer=completer,
                          complete_while_typing=Always())
        except EOFError:
            break

        if text in EXIT:
            break

        if text.startswith(TOKEN):
            execute(text)
        else:
            click.secho('Guru meditation error. ' + SYNTAX, fg='red')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号