Implement a command shell for kitty

Run it with:

kitty @
This commit is contained in:
Kovid Goyal
2018-04-06 12:11:37 +05:30
parent a32e010f89
commit 6141c9fdda
4 changed files with 173 additions and 2 deletions

View File

@@ -288,6 +288,7 @@ def wrap(text, limit=80):
def print_help_for_seq(seq, usage, message, appname):
from kitty.icat import screen_size
screen_size.changed = True
try:
linesz = min(screen_size().cols, 76)
except EnvironmentError:
@@ -337,7 +338,7 @@ def print_help_for_seq(seq, usage, message, appname):
a('')
text = '\n'.join(blocks) + '\n\n' + version()
if sys.stdout.isatty():
if print_help_for_seq.allow_pager and sys.stdout.isatty():
p = subprocess.Popen(['less', '-isRXF'], stdin=subprocess.PIPE)
p.communicate(text.encode('utf-8'))
raise SystemExit(p.wait())
@@ -345,6 +346,9 @@ def print_help_for_seq(seq, usage, message, appname):
print(text)
print_help_for_seq.allow_pager = True
def defval_for_opt(opt):
dv = opt.get('default')
typ = opt.get('type', '')