Fix the generated sample kitty.conf containing invalid options
This commit is contained in:
parent
4a7125ec92
commit
76f84e32c4
1 changed files with 8 additions and 1 deletions
|
|
@ -289,7 +289,11 @@ def as_conf(self, commented: bool = False, level: int = 0) -> List[str]:
|
|||
for k in self.items:
|
||||
if k.documented:
|
||||
documented = True
|
||||
a(f'{self.name} {k.defval_as_str if k.add_to_default else ""}'.rstrip())
|
||||
if k.add_to_default:
|
||||
a(f'{self.name} {k.defval_as_str}'.rstrip())
|
||||
else:
|
||||
# Comment out multi-options that have no default values
|
||||
a(f'# {self.name}'.rstrip())
|
||||
if not k.add_to_default and k.defval_as_str:
|
||||
a('')
|
||||
a(f'#: E.g. {self.name} {k.defval_as_str}'.rstrip())
|
||||
|
|
@ -565,6 +569,9 @@ def as_conf(self, commented: bool = False, level: int = 0) -> List[str]:
|
|||
|
||||
if commented:
|
||||
ans = [x if x.startswith('#') or not x.strip() else (f'# {x}') for x in ans]
|
||||
else:
|
||||
# Comment out any invalid options that have no value
|
||||
ans = [f'# {x}' if not x.startswith('#') and len(x.strip().split()) == 1 else x for x in ans]
|
||||
|
||||
return ans
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue