diff --git a/cmd/run.go b/cmd/run.go index b26b1a6..46e64b9 100644 --- a/cmd/run.go +++ b/cmd/run.go @@ -81,23 +81,39 @@ func NewRunCommand(factory *factory.ProviderFactory, scenarioOrchestrator *scena cmd.LocalFlags().AddFlagSet(scenarioFlags) cmd.SetHelpFunc(func(command *cobra.Command, args []string) { - fmt.Println("Krkn global flags:") - globalFlags.VisitAll(func(f *pflag.Flag) { - fmt.Printf(" --%s: %s\n", f.Name, f.Usage) - }) - - fmt.Println(fmt.Sprintf("\n%s Flags:", scenarioDetail.Name)) - scenarioFlags.VisitAll(func(f *pflag.Flag) { - fmt.Printf(" --%s: %s\n", f.Name, f.Usage) - }) + yellow := color.New(color.FgYellow).SprintFunc() + green := color.New(color.FgGreen).SprintFunc() + boldGreen := color.New(color.FgHiGreen, color.Bold).SprintFunc() + + fmt.Println(fmt.Sprintf("%s", yellow("Krkn Global flags"))) + for _, f := range globalEnvDetail.Fields { + if f.Default != nil && *f.Default != "" { + fmt.Printf(" --%s (%s): %s (Default: %s)\n", *f.Name, f.Type.String(), *f.Description, *f.Default) + } else { + fmt.Printf(" --%s (%s): %s\n", *f.Name, f.Type.String(), *f.Description) + } + + } + + fmt.Println(fmt.Sprintf("\n%s %s", boldGreen(scenarioDetail.Name), green("Flags"))) + for _, f := range scenarioDetail.Fields { + if f.Default != nil && *f.Default != "" { + fmt.Printf(" --%s (%s): %s (Default: %s)\n", *f.Name, f.Type.String(), *f.Description, *f.Default) + } else { + fmt.Printf(" --%s (%s): %s\n", *f.Name, f.Type.String(), *f.Description) + } + + } + fmt.Print("\n\n") + }) return nil }, RunE: func(cmd *cobra.Command, args []string) error { (*scenarioOrchestrator).PrintContainerRuntime() - spinner := NewSpinnerWithSuffix("validating input...") + spinner := NewSpinnerWithSuffix("fetching scenario metadata...") // Starts validating input message spinner.Start() @@ -184,6 +200,7 @@ func NewRunCommand(factory *factory.ProviderFactory, scenarioOrchestrator *scena if alertsProfile != nil { volumes[*alertsProfile] = config.AlertsProfilePath } + spinner.Suffix = "validating input ..." //dynamic flags parsing scenarioEnv, scenarioVol, err := ParseFlags(scenarioDetail, args, scenarioCollectedFlags, false) if err != nil {