From a8837aaaedb0032a1de3ebe8d30e8246881f7f5e Mon Sep 17 00:00:00 2001 From: Sam Alba Date: Fri, 21 May 2021 17:39:17 -0700 Subject: [PATCH] cmd/inputs: added --all option to list Signed-off-by: Sam Alba --- cmd/dagger/cmd/input/list.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/cmd/dagger/cmd/input/list.go b/cmd/dagger/cmd/input/list.go index 7d7b60b4..ab752235 100644 --- a/cmd/dagger/cmd/input/list.go +++ b/cmd/dagger/cmd/input/list.go @@ -51,7 +51,7 @@ var listCmd = &cobra.Command{ inputs := lDeploy.ScanInputs(ctx) w := tabwriter.NewWriter(os.Stdout, 0, 4, 2, ' ', 0) - fmt.Fprintln(w, "Input\tType\tValue\tSet by user\tSet in plan") + fmt.Fprintln(w, "Input\tType\tValue\tSet by user") for _, inp := range inputs { isConcrete := (inp.IsConcreteR() == nil) @@ -64,12 +64,18 @@ var listCmd = &cobra.Command{ valStr = fmt.Sprintf("%s (default)", valStr) } - fmt.Fprintf(w, "%s\t%s\t%s\t%t\t%t\n", + if !viper.GetBool("all") { + // skip input that is not overridable + if !hasDefault && isConcrete { + continue + } + } + + fmt.Fprintf(w, "%s\t%s\t%s\t%t\n", inp.Path(), getType(inp), valStr, isUserSet(environment, inp), - isConcrete, ) } @@ -105,6 +111,8 @@ func getType(val *compiler.Value) string { } func init() { + listCmd.Flags().BoolP("all", "a", false, "List all inputs (include non-overridable)") + if err := viper.BindPFlags(listCmd.Flags()); err != nil { panic(err) }