Skip to content

Allow expansion of env vars in options - #52

Merged
gcbeltramini merged 4 commits into
mainfrom
gb/env-vars-as-default
Jul 7, 2026
Merged

Allow expansion of env vars in options#52
gcbeltramini merged 4 commits into
mainfrom
gb/env-vars-as-default

Conversation

@gcbeltramini

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for expanding environment variables inside docopt option defaults (from the help/docstring), enabling defaults like $HOME or ${FOO} to resolve at parse time while keeping user-supplied values unexpanded.

Changes:

  • Expand $VAR / ${VAR} inside [default: ...] when parsing option descriptions in docopt_ng.
  • Add shell tests verifying default expansion, non-expansion of user input, unset-var behavior, and inert handling of $(...).
  • Adjust the bash_quote() docstring formatting.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
tests/core/helpers/test_cli_parse_args.sh Adds test coverage asserting env-var expansion behavior for docstring defaults and non-expansion for user input.
scripts/doc_parser/docopt_ng/init.py Implements env-var expansion for parsed defaults and introduces expand_env_vars() used during option parsing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/doc_parser/docopt_ng/__init__.py
Comment thread tests/core/helpers/test_cli_parse_args.sh Outdated
Comment thread scripts/doc_parser/docopt_ng/__init__.py Outdated
gcbeltramini and others added 3 commits July 7, 2026 12:16
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@gcbeltramini
gcbeltramini merged commit 7b035a5 into main Jul 7, 2026
1 check passed
@gcbeltramini
gcbeltramini deleted the gb/env-vars-as-default branch July 7, 2026 15:22
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.

2 participants