diff --git a/cmd/environment/environment.go b/cmd/environment/environment.go index 1dae9ec..33af4d9 100644 --- a/cmd/environment/environment.go +++ b/cmd/environment/environment.go @@ -1,6 +1,7 @@ package environment import ( + _ "embed" "fmt" "github.com/charmbracelet/log" @@ -11,7 +12,11 @@ import ( "github.com/spf13/viper" ) +//go:embed environment.md +var environmentHelp string + func NewEnvironmentCommand() *cobra.Command { + help := util.ParseHelp(environmentHelp) var env string var overwrite bool var erase bool @@ -19,8 +24,8 @@ func NewEnvironmentCommand() *cobra.Command { cmd := &cobra.Command{ Use: "environment", Short: "Manage Environments for the CLI", - Long: "\nManage Environments for the CLI\n\n", - Example: "sail env dev", + Long: help.Long, + Example: help.Example, Aliases: []string{"env"}, Args: cobra.MaximumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { @@ -65,7 +70,7 @@ func NewEnvironmentCommand() *cobra.Command { } } else { - log.Warn("No Environment Provided") + cmd.Help() } return nil diff --git a/cmd/environment/environment.md b/cmd/environment/environment.md new file mode 100644 index 0000000..429dac3 --- /dev/null +++ b/cmd/environment/environment.md @@ -0,0 +1,48 @@ +==Long== +# Environment + +Configure SailPoint IdentityNow environments for the CLI +==== + +==Example== +## Adding an new environment + +You can add new environments by supplying a name that does not already exist. The CLI will prompt you for the Tenant URL and API URL. + +```bash +sail environment {environment-name} +``` + + +## Switching environments + +You can switch between environments by supplying the name of an existing environment you want to switch to. + +```bash +sail environment {environment-name} +``` + +## Removing an environment + +You can remove an environment by supplying the name of an existing environment you want to remove in combination with the `--erase` flag. + +```bash +sail environment {environment-name} --erase +``` + +## Overwriting an environment + +You can overwrite an environment by supplying the name of an existing environment you want to overwrite in combination with the `--overwrite` flag. + +```bash +sail environment {environment-name} --overwrite +``` + +## Showing an environment + +You can print an environment by supplying the name of an existing environment you want to print in combination with the `--show` flag. + +```bash +sail environment {environment-name} --show +``` +==== \ No newline at end of file