Skip to content

Parse nested expressions in flag defaults - #146

Open
vinsymoyya wants to merge 1 commit into
google:mainfrom
vinsymoyya:fix/nested-flag-defaults
Open

vinsymoyya wants to merge 1 commit into
google:mainfrom
vinsymoyya:fix/nested-flag-defaults

Conversation

@vinsymoyya

Copy link
Copy Markdown

Nested expressions in flag defaults currently disappear from generated help, and parentheses inside string literals can truncate the displayed default. For example, get(split(s:foobar), 0, '') produces no Default line.

Keep the existing flag-name recognition and scan the default expression with balanced parentheses and Vim single/double-quoted string handling. Stop at the flag call's closing parenthesis, preserving arbitrary nesting and escaped quotes. Incomplete expressions continue to omit the default rather than emitting a truncated value.

Fixes #122.

Validation: six nested/quoted expression cases fail against upstream b2b9273. After the fix, python -m pytest -q --doctest-modules passes all 14 tests/doctest modules and 4 subtests. Coverage includes the report's line-continuation form and an incomplete expression. git diff --check passes. The source checkout emits the existing setuptools-scm version warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] cannot handle nested brace

1 participant