Dont fail to output usage when less is not present
This commit is contained in:
parent
2a7aa46b77
commit
a7f0a471ed
16
kitty/cli.py
16
kitty/cli.py
@ -16,7 +16,7 @@ from .cli_stub import CLIOptions
|
|||||||
from .conf.utils import resolve_config
|
from .conf.utils import resolve_config
|
||||||
from .constants import (
|
from .constants import (
|
||||||
appname, clear_handled_signals, config_dir, defconf, is_macos, str_version,
|
appname, clear_handled_signals, config_dir, defconf, is_macos, str_version,
|
||||||
website_url
|
website_url, default_pager_for_help
|
||||||
)
|
)
|
||||||
from .fast_data_types import wcswidth
|
from .fast_data_types import wcswidth
|
||||||
from .options.types import Options as KittyOpts
|
from .options.types import Options as KittyOpts
|
||||||
@ -474,12 +474,16 @@ class PrintHelpForSeq:
|
|||||||
text = '\n'.join(blocks) + '\n\n' + version()
|
text = '\n'.join(blocks) + '\n\n' + version()
|
||||||
if print_help_for_seq.allow_pager and sys.stdout.isatty():
|
if print_help_for_seq.allow_pager and sys.stdout.isatty():
|
||||||
import subprocess
|
import subprocess
|
||||||
p = subprocess.Popen(['less', '-iRXF'], stdin=subprocess.PIPE, preexec_fn=clear_handled_signals)
|
|
||||||
try:
|
try:
|
||||||
p.communicate(text.encode('utf-8'))
|
p = subprocess.Popen(default_pager_for_help, stdin=subprocess.PIPE, preexec_fn=clear_handled_signals)
|
||||||
except KeyboardInterrupt:
|
except FileNotFoundError:
|
||||||
raise SystemExit(1)
|
print(text)
|
||||||
raise SystemExit(p.wait())
|
else:
|
||||||
|
try:
|
||||||
|
p.communicate(text.encode('utf-8'))
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
raise SystemExit(1)
|
||||||
|
raise SystemExit(p.wait())
|
||||||
else:
|
else:
|
||||||
print(text)
|
print(text)
|
||||||
|
|
||||||
|
|||||||
@ -30,6 +30,7 @@ is_freebsd: bool = 'freebsd' in _plat
|
|||||||
is_running_from_develop: bool = False
|
is_running_from_develop: bool = False
|
||||||
RC_ENCRYPTION_PROTOCOL_VERSION = '1'
|
RC_ENCRYPTION_PROTOCOL_VERSION = '1'
|
||||||
website_base_url = 'https://sw.kovidgoyal.net/kitty/'
|
website_base_url = 'https://sw.kovidgoyal.net/kitty/'
|
||||||
|
default_pager_for_help = ('less', '-iRXF')
|
||||||
if getattr(sys, 'frozen', False):
|
if getattr(sys, 'frozen', False):
|
||||||
extensions_dir: str = getattr(sys, 'kitty_run_data')['extensions_dir']
|
extensions_dir: str = getattr(sys, 'kitty_run_data')['extensions_dir']
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user