Use program directives to namespace options

This commit is contained in:
Kovid Goyal 2018-05-30 15:32:50 +05:30
parent a3e4c74f5d
commit f8fa76d77e
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
4 changed files with 5 additions and 3 deletions

View File

@ -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'))
# }}}

View File

@ -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

View File

@ -1,4 +1,6 @@
The kitty command line interface
====================================
.. program:: kitty
.. include:: generated/cli-kitty.rst

View File

@ -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: