-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Add profile as an option to every click command #12500
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
Conversation
Add warnings to comments that sys.argv is modified.
LocalStack Community integration with Pro 2 files ±0 2 suites ±0 1h 52m 24s ⏱️ -41s Results for commit 3d21af5. ± Comparison against base commit 69d7a75. This pull request removes 1 and adds 5 tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a decent solution for now. Clean implementation and well documented 💯 Thank you Jim!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a great solution! Even though manipulating the sys.argv
is a bit hacky, it is the cleanest solution considering that (a) we have to evaluate the profile before we load the config
module and (b) there is no native support for global arugments in click (pallets/click#108)! 💯
Clean implementation, nice unit tests, clear documentation! 🦸🏽
The failing checks in your PR are due to flaky transcribe
tests which have already been marked to skip on master
with #12509.
Imho this is ready to be merged! 🥳
I've reworked this PR as follows.
Note the updated PR description which discussed the existing bugged behaviour of @alexrashed could you give this another check please seeing as the PR is substantially changed? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing the issue with the abbreviation / -p
! This conflict could really cause a bit of confusion. I think it's fair to just allow --profile
on all levels. The implementation and the tests are looking good! 💯
Motivation
We've had feedback that mandating the
--profile
option be specified at the top level, before any actions, is overly restrictive and causes headaches when wrapping the CLI in custom developer tools. The following currently works:but the following:
fails with:
Changes
--profile
can now be specified at any point. This is achieved by removing any occurrences of--profile
options from the command line arguments (sys.argv
) before click gets invoked.The profile option was already being read and used before click was invoked, and click performed no further processing of it. The only functionality that click was actually performing w.r.t. the profile option was:
--profile
no longer makes it through to click, so 2. never happens.There is no change to the processing of
-p
because that option is used in at least one subcommand. Therefore it would break those options if we were to strip it out like--profile
. Ideally, we would remove the ability to specify a profile using-p
as there is a pre-existing issue whereby if a port mapping command was specified, e.g.localstart start -p 80:8080
, then localstack would start using a profile called80:8080
. However, this would break back-compatibility.There is another top-level switch
--debug
and this remains top-level only. The reasoning behind this decision is:--profile
.