|
8 | 8 | "github.com/deepsourcelabs/cli/buildinfo" |
9 | 9 | "github.com/deepsourcelabs/cli/command/auth" |
10 | 10 | completionCmd "github.com/deepsourcelabs/cli/command/completion" |
| 11 | + updateCmd "github.com/deepsourcelabs/cli/command/update" |
11 | 12 | "github.com/deepsourcelabs/cli/command/issues" |
12 | 13 | "github.com/deepsourcelabs/cli/command/metrics" |
13 | 14 | "github.com/deepsourcelabs/cli/command/report" |
@@ -89,7 +90,12 @@ func NewCmdRoot() *cobra.Command { |
89 | 90 | completionC.GroupID = "setup" |
90 | 91 | cmd.AddCommand(completionC) |
91 | 92 |
|
| 93 | + updateC := updateCmd.NewCmdUpdate() |
| 94 | + updateC.GroupID = "setup" |
| 95 | + cmd.AddCommand(updateC) |
| 96 | + |
92 | 97 | cmd.PersistentFlags().Bool("skip-tls-verify", false, "Skip TLS certificate verification (for self-signed certs)") |
| 98 | + cmd.Flags().BoolP("verbose", "v", false, "Show detailed output including examples") |
93 | 99 |
|
94 | 100 | cmd.InitDefaultHelpFlag() |
95 | 101 | cmd.InitDefaultVersionFlag() |
@@ -167,13 +173,19 @@ func rootHelpFunc(cmd *cobra.Command, _ []string) { |
167 | 173 | } |
168 | 174 | } |
169 | 175 |
|
170 | | - // Examples |
171 | | - examples := buildExampleText() |
172 | | - if examples != "" { |
173 | | - fmt.Fprintf(out, "%s\n", style.BoldCyan("Examples:")) |
174 | | - for _, line := range strings.Split(examples, "\n") { |
175 | | - fmt.Fprintf(out, " %s\n", line) |
| 176 | + // Examples (shown only with --verbose / -v) |
| 177 | + verbose, _ := cmd.Flags().GetBool("verbose") |
| 178 | + if verbose { |
| 179 | + examples := buildExampleText() |
| 180 | + if examples != "" { |
| 181 | + fmt.Fprintf(out, "%s\n", style.BoldCyan("Examples:")) |
| 182 | + for _, line := range strings.Split(examples, "\n") { |
| 183 | + fmt.Fprintf(out, " %s\n", line) |
| 184 | + } |
| 185 | + fmt.Fprintln(out) |
176 | 186 | } |
| 187 | + } else { |
| 188 | + fmt.Fprintln(out, pterm.Gray("Use --help -v to see usage examples.")) |
177 | 189 | fmt.Fprintln(out) |
178 | 190 | } |
179 | 191 |
|
|
0 commit comments