Merge pull request #1724 from talentedmrjones/dagger-error-on-action-not-exists
fixes issue where specifying a non existent action doesnt error properly
This commit is contained in:
commit
116e25ce20
@ -111,6 +111,7 @@ func doHelp(cmd *cobra.Command, _ []string) {
|
|||||||
errorMsg string
|
errorMsg string
|
||||||
loadedMsg string
|
loadedMsg string
|
||||||
actionLookupPathMsg string
|
actionLookupPathMsg string
|
||||||
|
action *plan.Action
|
||||||
actions []*plan.Action
|
actions []*plan.Action
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -120,9 +121,14 @@ func doHelp(cmd *cobra.Command, _ []string) {
|
|||||||
} else {
|
} else {
|
||||||
loadedMsg = "Plan loaded from " + planPath
|
loadedMsg = "Plan loaded from " + planPath
|
||||||
actionLookupPath := getTargetPath(cmd.Flags().Args())
|
actionLookupPath := getTargetPath(cmd.Flags().Args())
|
||||||
actions = p.Action().FindByPath(actionLookupPath).Children
|
action = p.Action().FindByPath(actionLookupPath)
|
||||||
|
if action == nil {
|
||||||
|
errorMsg = "Error: action not found\n\n"
|
||||||
|
} else {
|
||||||
|
actions = action.Children
|
||||||
actionLookupPathMsg = fmt.Sprintf(`%s:`, actionLookupPath.String())
|
actionLookupPathMsg = fmt.Sprintf(`%s:`, actionLookupPath.String())
|
||||||
}
|
}
|
||||||
|
}
|
||||||
fmt.Printf(`%s%s
|
fmt.Printf(`%s%s
|
||||||
|
|
||||||
%s
|
%s
|
||||||
|
Reference in New Issue
Block a user