-
-
Notifications
You must be signed in to change notification settings - Fork 91
/
workflow.go
36 lines (31 loc) · 1.2 KB
/
workflow.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package cmd
import (
"github.com/spf13/cobra"
e "github.com/cloudposse/atmos/internal/exec"
u "github.com/cloudposse/atmos/pkg/utils"
)
// workflowCmd executes a workflow
var workflowCmd = &cobra.Command{
Use: "workflow",
Short: "Execute a workflow",
Long: `This command executes a workflow: atmos workflow <name> -f <file>`,
Example: "atmos workflow\n" +
"atmos workflow <name> -f <file>\n" +
"atmos workflow <name> -f <file> -s <stack>\n" +
"atmos workflow <name> -f <file> --from-step <step-name>",
FParseErrWhitelist: struct{ UnknownFlags bool }{UnknownFlags: false},
Run: func(cmd *cobra.Command, args []string) {
err := e.ExecuteWorkflowCmd(cmd, args)
if err != nil {
u.LogErrorAndExit(err)
}
},
}
func init() {
workflowCmd.DisableFlagParsing = false
workflowCmd.PersistentFlags().StringP("file", "f", "", "atmos workflow <name> -f <file>")
workflowCmd.PersistentFlags().Bool("dry-run", false, "atmos workflow <name> -f <file> --dry-run")
workflowCmd.PersistentFlags().StringP("stack", "s", "", "atmos workflow <name> -f <file> -s <stack>")
workflowCmd.PersistentFlags().String("from-step", "", "atmos workflow <name> -f <file> --from-step <step-name>")
RootCmd.AddCommand(workflowCmd)
}