-
-
Notifications
You must be signed in to change notification settings - Fork 132
[Feature improvement] Added default values handling for custom CLI flags #1379
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
📝 WalkthroughWalkthroughThis update introduces support for default values in custom command flags by enhancing flag processing logic and extending the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CLI
participant CommandFlag
Note over CLI: On command initialization
CLI->>CommandFlag: Read flag definitions (with Default)
CLI->>CLI: For each flag, set default value<br/>(parse Default for bool, use directly for string)
User->>CLI: Run command with/without flag
CLI->>CLI: Use provided or default flag value
Estimated code review effort2 (~15 minutes) Possibly related PRs
Suggested labels
Suggested reviewers
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (3)
📓 Path-based instructions (2)**/*.go📄 CodeRabbit Inference Engine (.cursor/rules/atmos-rules.mdc)
Files:
cmd/*.go📄 CodeRabbit Inference Engine (.cursor/rules/atmos-rules.mdc)
Files:
🧠 Learnings (4)📓 Common learnings
atmos.yaml (8)Learnt from: Listener430 Learnt from: Listener430 Learnt from: osterman Learnt from: RoseSecurity Learnt from: osterman Learnt from: Listener430 Learnt from: aknysh Learnt from: aknysh pkg/schema/schema.go (4)Learnt from: samtholiya Learnt from: samtholiya Learnt from: CR Learnt from: aknysh cmd/cmd_utils.go (20)Learnt from: CR Learnt from: CR Learnt from: CR Learnt from: CR Learnt from: samtholiya Learnt from: aknysh Learnt from: Listener430 Learnt from: CR Learnt from: samtholiya Learnt from: CR Learnt from: CR Learnt from: CR Learnt from: osterman Learnt from: Cerebrovinny Learnt from: CR Learnt from: CR Learnt from: CR Learnt from: CR Learnt from: CR Learnt from: samtholiya 🧰 Additional context used📓 Path-based instructions (2)**/*.go📄 CodeRabbit Inference Engine (.cursor/rules/atmos-rules.mdc)
Files:
cmd/*.go📄 CodeRabbit Inference Engine (.cursor/rules/atmos-rules.mdc)
Files:
🧠 Learnings (4)📓 Common learnings
atmos.yaml (8)Learnt from: Listener430 Learnt from: Listener430 Learnt from: osterman Learnt from: RoseSecurity Learnt from: osterman Learnt from: Listener430 Learnt from: aknysh Learnt from: aknysh pkg/schema/schema.go (4)Learnt from: samtholiya Learnt from: samtholiya Learnt from: CR Learnt from: aknysh cmd/cmd_utils.go (20)Learnt from: CR Learnt from: CR Learnt from: CR Learnt from: CR Learnt from: samtholiya Learnt from: aknysh Learnt from: Listener430 Learnt from: CR Learnt from: samtholiya Learnt from: CR Learnt from: CR Learnt from: CR Learnt from: osterman Learnt from: Cerebrovinny Learnt from: CR Learnt from: CR Learnt from: CR Learnt from: CR Learnt from: CR Learnt from: samtholiya ⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (5)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1379 +/- ##
==========================================
+ Coverage 54.21% 54.23% +0.01%
==========================================
Files 259 259
Lines 27167 27178 +11
==========================================
+ Hits 14728 14739 +11
+ Misses 10733 10728 -5
- Partials 1706 1711 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
These changes were released in v1.184.0. |
what
This PR enhances the custom command flag handling in Atmos CLI with the following improvements:
Default Values for Custom Command Flags:
Added support for specifying a default value for custom command flags in the Atmos YAML configuration.
User Value Precedence:
If a flag is set by the user, that value is always used, overriding any default.
Backward Compatibility:
The original behavior is preserved for flags without a default value, ensuring no breaking changes for existing configurations.
Functionality added
why
Default values always are useful and they were not available for flags. Arguments cannot completely replace it and provide with the correct functionalities.
Let me explain — this feature already exists for arguments (such as positional ones), but it’s not possible, for example, to define only
arg1
andarg3
withoutarg3
being interpreted asarg2
.The advantage of using flags is that they are prefixed (e.g.,
--flagname
), which allows them to be specified independently and avoids ambiguity.references
This feature was discussed in the
atmos
channel of the slack.Summary by CodeRabbit
New Features
Style