Skip to content

Commit 1b16eec

Browse files
Copilotkovidgoyal
andauthored
fix: address code review feedback - readability and edge case for value options
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/046a1de7-ad0d-46a5-8383-c06025d1d4eb Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
1 parent 79bbcc6 commit 1b16eec

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

kitty/session.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,12 @@ def save_as_session_part2(boss: BossType, opts: SaveAsSessionOptions, path: str)
709709
def _save_as_session_value_options() -> frozenset[str]:
710710
from .simple_cli_definitions import parse_option_spec
711711
seq, _ = parse_option_spec(save_as_session_options())
712-
return frozenset(alias for item in seq if hasattr(item, 'type') and item.type not in ('bool-set', 'bool-reset') for alias in item.aliases)
712+
return frozenset(
713+
alias
714+
for item in seq
715+
if hasattr(item, 'type') and item.type not in ('bool-set', 'bool-reset')
716+
for alias in item.aliases
717+
)
713718

714719

715720
def parse_save_as_options_spec_args(args: list[str]) -> tuple[SaveAsSessionOptions, list[str]]:
@@ -730,7 +735,8 @@ def parse_save_as_options_spec_args(args: list[str]) -> tuple[SaveAsSessionOptio
730735
break
731736
if a.startswith('-'):
732737
options.append(a)
733-
if '=' not in a and a in value_options and i + 1 < len(args):
738+
next_is_value = i + 1 < len(args) and not args[i + 1].startswith('-')
739+
if '=' not in a and a in value_options and next_is_value:
734740
i += 1
735741
options.append(args[i])
736742
else:

0 commit comments

Comments
 (0)