-
-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
atmos describe workflows
CLI command. Add interactive UI for `a…
…tmos workflow` command (#519) * Updates * Updates * Updates * Updates * Updates * Updates * Updates * Updates * Updates * Updates * Updates * Updates * Updates * Updates * Updates * Updates * Updates * Updates * Updates * Updates * Updates * Updates * Updates * Updates * Updates * Updates * Updates * Updates * Updates * Updates * Updates * Updates * Updates * Updates * Updates * Updates * Updates * Updates * Updates * Updates * Updates * Updates * Updates * Updates * Updates * Updates * Updates * Updates * Updates * chore: update repo banner image --------- Co-authored-by: screenshot-action 📷 <[email protected]>
- Loading branch information
1 parent
71efbe3
commit 8f00ba2
Showing
40 changed files
with
1,305 additions
and
61 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,36 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
|
||
e "github.com/cloudposse/atmos/internal/exec" | ||
u "github.com/cloudposse/atmos/pkg/utils" | ||
) | ||
|
||
// describeWorkflowsCmd executes 'atmos describe workflows' CLI commands | ||
var describeWorkflowsCmd = &cobra.Command{ | ||
Use: "workflows", | ||
Short: "Execute 'describe workflows' commands", | ||
Long: `This command executes 'atmos describe workflows' CLI command`, | ||
Example: "describe workflows\n" + | ||
"describe workflows --format json\n" + | ||
"describe workflows -f yaml\n" + | ||
"describe workflows --output list\n" + | ||
"describe workflows -o map -f json\n" + | ||
"describe workflows -o map\n" + | ||
"describe workflows -o all", | ||
FParseErrWhitelist: struct{ UnknownFlags bool }{UnknownFlags: false}, | ||
Run: func(cmd *cobra.Command, args []string) { | ||
err := e.ExecuteDescribeWorkflowsCmd(cmd, args) | ||
if err != nil { | ||
u.LogErrorAndExit(err) | ||
} | ||
}, | ||
} | ||
|
||
func init() { | ||
describeWorkflowsCmd.PersistentFlags().StringP("format", "f", "yaml", "Specify the output format: atmos describe workflows --format=<yaml|json> ('yaml' is default)") | ||
describeWorkflowsCmd.PersistentFlags().StringP("output", "o", "list", "Specify the output type: atmos describe workflows --output=<list|map|all> ('list' is default)") | ||
|
||
describeCmd.AddCommand(describeWorkflowsCmd) | ||
} |
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
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
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
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
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,66 @@ | ||
package exec | ||
|
||
import ( | ||
"fmt" | ||
cfg "github.com/cloudposse/atmos/pkg/config" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
// ExecuteDescribeWorkflowsCmd executes `atmos describe workflows` CLI command | ||
func ExecuteDescribeWorkflowsCmd(cmd *cobra.Command, args []string) error { | ||
info, err := processCommandLineArgs("terraform", cmd, args, nil) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
cliConfig, err := cfg.InitCliConfig(info, true) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
flags := cmd.Flags() | ||
|
||
format, err := flags.GetString("format") | ||
if err != nil { | ||
return err | ||
} | ||
|
||
if format != "" && format != "yaml" && format != "json" { | ||
return fmt.Errorf("invalid '--format' flag '%s'. Valid values are 'yaml' (default) and 'json'", format) | ||
} | ||
|
||
if format == "" { | ||
format = "yaml" | ||
} | ||
|
||
outputType, err := flags.GetString("output") | ||
if err != nil { | ||
return err | ||
} | ||
|
||
if outputType != "" && outputType != "list" && outputType != "map" && outputType != "all" { | ||
return fmt.Errorf("invalid '--output' flag '%s'. Valid values are 'list' (default), 'map' and 'all'", outputType) | ||
} | ||
|
||
if outputType == "" { | ||
outputType = "list" | ||
} | ||
|
||
describeWorkflowsList, describeWorkflowsMap, describeWorkflowsAll, err := ExecuteDescribeWorkflows(cliConfig) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
if outputType == "list" { | ||
err = printOrWriteToFile(format, "", describeWorkflowsList) | ||
} else if outputType == "map" { | ||
err = printOrWriteToFile(format, "", describeWorkflowsMap) | ||
} else { | ||
err = printOrWriteToFile(format, "", describeWorkflowsAll) | ||
} | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} |
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
Oops, something went wrong.