From f8fa76d77e0de6aeaaf5f5816e3b2372472b5ae7 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 30 May 2018 15:32:50 +0530 Subject: [PATCH] Use program directives to namespace options --- docs/conf.py | 2 +- docs/index.rst | 2 +- docs/invocation.rst | 2 ++ kitty/cli.py | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 8f6931dc6..f9fea1309 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -267,7 +267,7 @@ def add_html_context(app, pagename, templatename, context, *args): def write_cli_docs(): from kitty.cli import option_spec_as_rst with open('generated/cli-kitty.rst', 'w') as f: - f.write(option_spec_as_rst(appname='kitty')) + f.write(option_spec_as_rst(appname='kitty').replace('kitty --to', 'kitty @ --to')) # }}} diff --git a/docs/index.rst b/docs/index.rst index 6741cb5dc..5d58691e7 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -242,7 +242,7 @@ Startup Sessions ------------------ You can control the tabs, window layout, working directory, startup -programs, etc. by creating a "session" file and using the :option:`--session` +programs, etc. by creating a "session" file and using the :option:`kitty --session` command line flag. For example: .. code-block:: ini diff --git a/docs/invocation.rst b/docs/invocation.rst index 98d932b25..6f1bfad49 100644 --- a/docs/invocation.rst +++ b/docs/invocation.rst @@ -1,4 +1,6 @@ The kitty command line interface ==================================== +.. program:: kitty + .. include:: generated/cli-kitty.rst diff --git a/kitty/cli.py b/kitty/cli.py index 261160453..ce9f4a340 100644 --- a/kitty/cli.py +++ b/kitty/cli.py @@ -416,7 +416,7 @@ def seq_as_rst(seq, usage, message, appname): t = re.sub(r':$', '::', t, flags=re.MULTILINE) t = t.replace('::\n\n\t ', '::\n \n ') t = t.replace('\n\n\t ', '\n \n') - t = re.sub(r'(--[a-zA-Z0-9-]+)', r':option:`\1` ', t) + t = re.sub(r'(--[a-zA-Z0-9-]+)', r':option:`{} \1` '.format(appname), t) t = re.sub('"(.+?)"', r'``\1``', t) a(textwrap.indent(prettify_rst(t), ' ' * 4)) if defval is not None: