KuthumiPepple commented on code in PR #3227: URL: https://github.com/apache/camel-k/pull/3227#discussion_r859980220
########## pkg/cmd/root.go: ########## @@ -237,3 +241,36 @@ func (command *RootCmdOptions) GetCamelCmdClient() (*v1.CamelV1Client, error) { func (command *RootCmdOptions) NewCmdClient() (client.Client, error) { return client.NewOutOfClusterClient(command.KubeConfig) } + +func wrappedFlagUsages(cmd *cobra.Command) string { + width := 80 + if w, _, err := term.GetSize(0); err == nil { + width = w + } + return cmd.Flags().FlagUsagesWrapped(width - 1) +} + +var usageTemplate = `Usage:{{if .Runnable}} + {{.UseLine}}{{end}}{{if .HasAvailableSubCommands}} + {{.CommandPath}} [command]{{end}}{{if gt (len .Aliases) 0}} + +Aliases: + {{.NameAndAliases}}{{end}}{{if .HasExample}} + +Examples: +{{.Example}}{{end}}{{if .HasAvailableSubCommands}} + +Available Commands:{{range .Commands}}{{if (or .IsAvailableCommand (eq .Name "help"))}} + {{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{end}}{{if .HasAvailableLocalFlags}} + +Flags: +{{ wrappedFlagUsages . | trimTrailingWhitespaces}}{{end}}{{if .HasAvailableInheritedFlags}} + +Global Flags: +{{.InheritedFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if .HasHelpSubCommands}} + +Additional help topics:{{range .Commands}}{{if .IsAdditionalHelpTopicCommand}} Review Comment: Will do -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org