DRYer
This commit is contained in:
parent
d2a31a6a0f
commit
7f1c5d8534
@ -160,7 +160,7 @@ def main(args: List[str]) -> Response:
|
|||||||
import readline as rl
|
import readline as rl
|
||||||
readline = rl
|
readline = rl
|
||||||
from kitty.shell import init_readline
|
from kitty.shell import init_readline
|
||||||
init_readline(readline)
|
init_readline()
|
||||||
response = None
|
response = None
|
||||||
|
|
||||||
with alternate_screen(), HistoryCompleter(cli_opts.name):
|
with alternate_screen(), HistoryCompleter(cli_opts.name):
|
||||||
|
|||||||
@ -30,7 +30,8 @@ def match_commands() -> Tuple[str, ...]:
|
|||||||
return tuple(sorted(all_commands + ('exit', 'help', 'quit')))
|
return tuple(sorted(all_commands + ('exit', 'help', 'quit')))
|
||||||
|
|
||||||
|
|
||||||
def init_readline(readline: Any) -> None:
|
@run_once
|
||||||
|
def init_readline() -> None:
|
||||||
with suppress(OSError):
|
with suppress(OSError):
|
||||||
readline.read_init_file()
|
readline.read_init_file()
|
||||||
if 'libedit' in readline.__doc__:
|
if 'libedit' in readline.__doc__:
|
||||||
@ -155,7 +156,7 @@ def run_cmd(global_opts: RCOptions, cmd: str, func: RemoteCommand, opts: Any, it
|
|||||||
|
|
||||||
|
|
||||||
def real_main(global_opts: RCOptions) -> None:
|
def real_main(global_opts: RCOptions) -> None:
|
||||||
init_readline(readline)
|
init_readline()
|
||||||
print_help_for_seq.allow_pager = False
|
print_help_for_seq.allow_pager = False
|
||||||
print('Welcome to the kitty shell!')
|
print('Welcome to the kitty shell!')
|
||||||
print('Use {} for assistance or {} to quit'.format(green('help'), green('exit')))
|
print('Use {} for assistance or {} to quit'.format(green('help'), green('exit')))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user