-
-
Notifications
You must be signed in to change notification settings - Fork 103
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
use default value for required arg if not provided #763
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Pulak Kanti Bhowmick <pkbhowmick007@gmail.com>
Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <erik@cloudposse.com>
@pkbhowmick this PR is now in conflict |
Please add something to this page: https://atmos.tools/core-concepts/custom-commands/ |
@coderabbitai can you suggest the changes to documentation related to this PR |
Tip For best results, initiate chat on the files or code changes. @osterman, here's a suggestion for updating the documentation related to this PR: Add a section to the Custom Commands documentation explaining that atmos now uses the default value for a required argument if it's not provided. This enhances flexibility when invoking custom commands. For example, you could add: ### Default Values for Required Arguments
Atmos allows you to define default values for required arguments in your custom commands. If a required argument is not provided when the command is invoked, atmos will use the specified default value.
**Example:**
Given a custom command configuration:
```yaml
commands:
deploy-stack:
description: "Deploy a stack."
arguments:
- name: "environment"
description: "The environment to deploy."
required: true
default: "dev" You can now run:
Atmos will use "dev" as the default value for the
|
Hi @osterman I believe there is order related issue too for commands who have multiple arguments. Please correct me in case I miss something. |
I think you're right that it doesn't support it natively, but I think they address the use-case in their docs. The gist of it is I think you need to check args directly, and use the defaults manually. Example of the logic:
|
what
why
references