Show the current theme name in kitty.conf as well
This commit is contained in:
parent
5a47e0d2e4
commit
e376c79dda
@ -28,8 +28,8 @@ MARK_BEFORE = '\033[33m'
|
||||
MARK_AFTER = '\033[39m'
|
||||
|
||||
|
||||
def patch_conf(raw: str) -> str:
|
||||
addition = '# BEGIN_KITTY_THEME\ninclude current-theme.conf\n# END_KITTY_THEME'
|
||||
def patch_conf(raw: str, theme_name: str) -> str:
|
||||
addition = f'# BEGIN_KITTY_THEME\n# {theme_name}\ninclude current-theme.conf\n# END_KITTY_THEME'
|
||||
nraw, num = re.subn(r'^# BEGIN_KITTY_THEME.+?# END_KITTY_THEME', addition, raw, flags=re.MULTILINE | re.DOTALL)
|
||||
if not num:
|
||||
if raw:
|
||||
@ -263,7 +263,7 @@ class Theme:
|
||||
raw = f.read()
|
||||
except FileNotFoundError:
|
||||
raw = ''
|
||||
nraw = patch_conf(raw)
|
||||
nraw = patch_conf(raw, self.name)
|
||||
if raw:
|
||||
with open(confpath + '.bak', 'w') as f:
|
||||
f.write(raw)
|
||||
|
||||
@ -565,7 +565,7 @@ def main(args: List[str]) -> None:
|
||||
input(_('Press Enter to quit'))
|
||||
return None
|
||||
if len(items) > 1:
|
||||
items = [' '.join(items[1:])]
|
||||
items = [' '.join(items)]
|
||||
if len(items) == 1:
|
||||
return non_interactive(cli_opts, items[0])
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user