Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support app_config in pre_parse_args() #295

Merged
merged 2 commits into from
Oct 22, 2024

Conversation

tigarmo
Copy link
Collaborator

@tigarmo tigarmo commented Oct 21, 2024

This lets the commands of a given application access the configuration dict during fill_parser() even when building the help message, like in app cmd -h. Of course, this can only be used in cases where the configuration dict contains data that the application already has at pre_parse_args()-time.

Fixes #292

  • Have you followed the guidelines for contributing?
  • Have you signed the CLA?
  • Have you successfully run tox?

@tigarmo tigarmo marked this pull request as draft October 21, 2024 19:47
@tigarmo tigarmo force-pushed the work/CRAFT-3585-command-help-app-config branch from c13ed65 to c3ec47c Compare October 21, 2024 20:44
This lets the commands of a given application access the configuration dict
during fill_parser() even when building the help message, like in `app cmd -h`.
Of course, this can only be used in cases where the configuration dict contains
data that the application already has at pre_parse_args()-time.

Fixes #292
@tigarmo tigarmo force-pushed the work/CRAFT-3585-command-help-app-config branch from c3ec47c to 0abec72 Compare October 21, 2024 20:49
@tigarmo tigarmo marked this pull request as ready for review October 21, 2024 20:57
@tigarmo tigarmo requested review from lengau, upils and mr-cal October 21, 2024 20:57
Copy link

@upils upils left a comment

Choose a reason for hiding this comment

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

LGTM. I suggested a couple of improvements in tests.

tests/unit/test_help.py Outdated Show resolved Hide resolved
craft_cli/dispatcher.py Show resolved Hide resolved
@tigarmo tigarmo requested a review from upils October 22, 2024 13:18
Copy link
Contributor

@mr-cal mr-cal left a comment

Choose a reason for hiding this comment

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

Thanks!

@tigarmo tigarmo added the squash label Oct 22, 2024
Copy link

@upils upils left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@tigarmo tigarmo merged commit 8bfac83 into main Oct 22, 2024
12 checks passed
@tigarmo tigarmo deleted the work/CRAFT-3585-command-help-app-config branch October 22, 2024 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pass application context when generating help messages
3 participants