This commit is contained in:
Kovid Goyal 2018-06-04 15:24:05 +05:30
parent ad29d7f639
commit cd36e3b314
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 12 additions and 10 deletions

View File

@ -373,7 +373,7 @@ def render_conf(conf_name, all_options):
current_group = None current_group = None
all_options = list(all_options) all_options = list(all_options)
for i, opt in enumerate(all_options): for i, opt in enumerate(all_options):
if not opt.long_text or not opt.add_to_default: if not opt.long_text or not opt.add_to_docs:
continue continue
if opt.group is not current_group: if opt.group is not current_group:
if current_group and current_group.end_text: if current_group and current_group.end_text:

View File

@ -23,13 +23,14 @@ class Group:
class Option: class Option:
__slots__ = 'name', 'group', 'long_text', 'option_type', 'defval_as_string', 'add_to_default' __slots__ = 'name', 'group', 'long_text', 'option_type', 'defval_as_string', 'add_to_default', 'add_to_docs'
def __init__(self, name, group, defval, option_type, long_text, add_to_default): def __init__(self, name, group, defval, option_type, long_text, add_to_default, add_to_docs):
self.name, self.group = name, group self.name, self.group = name, group
self.long_text, self.option_type = long_text.strip(), option_type self.long_text, self.option_type = long_text.strip(), option_type
self.defval_as_string = defval self.defval_as_string = defval
self.add_to_default = add_to_default self.add_to_default = add_to_default
self.add_to_docs = add_to_docs
def option( def option(
@ -39,7 +40,8 @@ def option(
defval, defval,
long_text='', long_text='',
option_type=to_string, option_type=to_string,
add_to_default=True add_to_default=True,
add_to_docs=True
): ):
is_multiple = name.startswith('+') is_multiple = name.startswith('+')
if is_multiple: if is_multiple:
@ -59,7 +61,7 @@ def option(
key = name key = name
if is_multiple: if is_multiple:
key = name + ' ' + defval.partition(' ')[0] key = name + ' ' + defval.partition(' ')[0]
ans = Option(name, group[0], defval, option_type, long_text, add_to_default) ans = Option(name, group[0], defval, option_type, long_text, add_to_default, add_to_docs)
all_options[key] = ans all_options[key] = ans
return ans return ans
@ -78,7 +80,7 @@ def merged_opts(all_options, opt, i):
yield opt yield opt
for k in range(i + 1, len(all_options)): for k in range(i + 1, len(all_options)):
q = all_options[k] q = all_options[k]
if not q.long_text and q.add_to_default: if not q.long_text and q.add_to_docs:
yield q yield q
else: else:
break break
@ -109,7 +111,7 @@ def as_conf_file(all_options):
current_group = None current_group = None
all_options = list(all_options) all_options = list(all_options)
for i, opt in enumerate(all_options): for i, opt in enumerate(all_options):
if not opt.long_text: if not opt.long_text or not opt.add_to_docs:
continue continue
if opt.group is not current_group: if opt.group is not current_group:
if current_group: if current_group:

View File

@ -135,7 +135,7 @@ o, g, all_groups = option_func(all_options, {
_('''\ _('''\
The 16 terminal colors. There are 8 basic colors, each color has a dull and The 16 terminal colors. There are 8 basic colors, each color has a dull and
bright version. You can also set the remaining colors from the 256 color table bright version. You can also set the remaining colors from the 256 color table
as color16 to color256.''') as color16 to color255.''')
], ],
'advanced': [_('Advanced')], 'advanced': [_('Advanced')],
'os': [_('OS specific tweaks')], 'os': [_('OS specific tweaks')],
@ -507,7 +507,7 @@ o('color15', '#ffffff', option_type=to_color)
dfctl = defines.default_color_table() dfctl = defines.default_color_table()
for i in range(16, 256): for i in range(16, 256):
k = 'color{}'.format(i) k = 'color{}'.format(i)
o(k, color_as_sharp(color_from_int(dfctl[i])), option_type=to_color, add_to_default=False) o(k, color_as_sharp(color_from_int(dfctl[i])), option_type=to_color, add_to_docs=False)
# }}} # }}}
@ -598,7 +598,7 @@ Hide the kitty window from running tasks (:kbd:`Option+Tab`) on macOS.
# }}} # }}}
g('shortcuts') # {{ g('shortcuts') # {{{
o('kitty_mod', 'ctrl+shift', option_type=to_modifiers, long_text=_(''' o('kitty_mod', 'ctrl+shift', option_type=to_modifiers, long_text=_('''
The value of :code:`kitty_mod` is used as the modifier for all default shortcuts, you The value of :code:`kitty_mod` is used as the modifier for all default shortcuts, you