Skip to content

Commit

Permalink
fix custom command invalid error sentence
Browse files Browse the repository at this point in the history
  • Loading branch information
samtholiya committed Feb 5, 2025
1 parent d3790d0 commit ffc48a3
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/cmd_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ func preCustomCommand(
} else {
// truly invalid, nothing to do
u.PrintErrorMarkdownAndExit("Invalid command", errors.New(
fmt.Sprintf("no args, no steps, no sub-commands provided in config for `%s`", cmd.CommandPath()),
fmt.Sprintf("The `%s` command has no steps or subcommands configured.", cmd.CommandPath()),
), "https://atmos.tools/cli/configuration/commands")
}
}
Expand Down
3 changes: 2 additions & 1 deletion tests/fixtures/scenarios/complete/atmos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,8 @@ commands:
> /dev/null
- chmod 600 ${KUBECONFIG}
- echo ${KUBECONFIG}

- name: "invalidCommand"
description: "This is an invalid command that neither has steps or sub command"
# Integrations
integrations:
# Atlantis integration
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file.
15 changes: 14 additions & 1 deletion tests/test-cases/complete.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,17 @@ tests:
- "No workflow exists"
- "test-1"
- "terraform-plan-all-test-components"
exit_code: 1
exit_code: 1
- name: atmos invalidCommand
enabled: true
snapshot: true
description: "Ensure atmos invalidCommand returns error"
workdir: "fixtures/scenarios/complete/"
command: "atmos"
args:
- "invalidCommand"
expect:
diff: []
stderr:
- "command has no steps or subcommands configured"
exit_code: 1

0 comments on commit ffc48a3

Please sign in to comment.