-
-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Trailing Args for Custom Commands (#1046)
* add doubble dash args support for custom command issue: https://linear.app/cloudposse/issue/DEV-112/add-support-for-double-dash-in-atmos-custom-commands * add test case for custom command double dash * refactor naming of variables and functions * add comment on the function * Update cmd/cmd_utils.go Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <erik@cloudposse.com> * [autofix.ci] apply automated fixes * updated suggested variable * Add documentation * fix tests * Update website/docs/core-concepts/custom-commands/custom-commands.mdx Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <erik@cloudposse.com> * Update website/docs/core-concepts/custom-commands/custom-commands.mdx Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <erik@cloudposse.com> * Update website/docs/core-concepts/custom-commands/custom-commands.mdx Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <erik@cloudposse.com> * Update website/docs/core-concepts/custom-commands/custom-commands.mdx --------- Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <erik@cloudposse.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Andriy Knysh <aknysh@users.noreply.github.com>
- Loading branch information
1 parent
28781ce
commit 2ccb7be
Showing
4 changed files
with
109 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
base_path: "./" | ||
|
||
stacks: | ||
base_path: "stacks" | ||
included_paths: | ||
- "deploy/**/*" | ||
logs: | ||
file: "/dev/stderr" | ||
level: Info | ||
|
||
commands: | ||
# # Use positional arguments with default values | ||
- name: echo | ||
description: "Displays a args before and after double dash." | ||
arguments: | ||
- name: name | ||
description: >- | ||
Enter your string as an argument | ||
required: true | ||
default: before double dash | ||
steps: | ||
- "echo Cobra Args: [{{ .Arguments.name }}]" | ||
- "echo Trailing Args: [{{ .TrailingArgs }}]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
tests: | ||
- name: double dash should work | ||
enabled: true | ||
description: "Validate atmos custom command greet runs with argument provided." | ||
workdir: "fixtures/scenarios/custom-command" | ||
command: "atmos" | ||
args: | ||
- "echo" | ||
- "Name" | ||
- "--" | ||
- "-this" | ||
- "--is" | ||
- "trailing" | ||
- "-" | ||
- "arg" | ||
expect: | ||
diff: [] | ||
stdout: | ||
- "Cobra Args: \\[Name\\]" | ||
- "Trailing Args: \\[-this --is trailing - arg\\]" | ||
stderr: | ||
- "^$" | ||
exit_code: 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters