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