33import subprocess
44
55import click
6- from prompt_toolkit import prompt
6+ from prompt_toolkit import PromptSession
77from prompt_toolkit .history import InMemoryHistory
88from prompt_toolkit .lexers import PygmentsLexer
9- from prompt_toolkit .styles . pygments import style_from_pygments_cls
9+ from prompt_toolkit .styles import style_from_pygments_cls
1010from pygments .styles import get_style_by_name
1111
1212from .__init__ import __version__
13+
1314# from .completion import command_completer
1415from .ext .completer import Completer
1516from .ext .utils import TextUtils
@@ -31,28 +32,28 @@ def execute(cmd):
3132
3233def cli ():
3334 history = InMemoryHistory ()
35+ session = PromptSession (history = history )
3436 style = style_from_pygments_cls (get_style_by_name ("monokai" ))
3537 lexer = PygmentsLexer (DiscogsCliLexer )
3638 completer = Completer (fuzzy_match = False , text_utils = TextUtils ())
3739
3840 SYNTAX = "Syntax: ogs <command> [options]"
3941
40- click .secho (" _ _ _ _ " , fg = "yellow" )
41- click .secho (" __| (_)___ ___ ___ __ _ ___ ___| (_)" , fg = "yellow" )
42- click .secho (" / _` | / __|/ __/ _ \ / _` / __|_____ / __| | |" , fg = "yellow" )
43- click .secho ("| (_| | \__ \ (_| (_) | (_| \__ \_____| (__| | |" , fg = "yellow" )
44- click .secho (" \__,_|_|___/\___\___/ \__, |___/ \___|_|_|" , fg = "yellow" )
45- click .secho (" |___/" , fg = "yellow" )
42+ click .secho (r " _ _ _ _ " , fg = "yellow" )
43+ click .secho (r " __| (_)___ ___ ___ __ _ ___ ___| (_)" , fg = "yellow" )
44+ click .secho (r " / _` | / __|/ __/ _ \ / _` / __|_____ / __| | |" , fg = "yellow" )
45+ click .secho (r "| (_| | \__ \ (_| (_) | (_| \__ \_____| (__| | |" , fg = "yellow" )
46+ click .secho (r " \__,_|_|___/\___\___/ \__, |___/ \___|_|_|" , fg = "yellow" )
47+ click .secho (r " |___/" , fg = "yellow" )
4648
4749 click .echo ("Version:" + __version__ )
4850 click .echo (SYNTAX )
4951
5052 while True :
5153 try :
52- text = prompt (
54+ text = session . prompt (
5355 "discogs-cli >>> " ,
5456 style = style ,
55- history = history ,
5657 completer = completer ,
5758 lexer = lexer ,
5859 )
0 commit comments