@@ -31,6 +31,7 @@ import (
3131 "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
3232 "github.com/stackitcloud/stackit-cli/internal/pkg/print"
3333
34+ "github.com/fatih/color"
3435 "github.com/spf13/cobra"
3536 "github.com/spf13/viper"
3637)
@@ -88,9 +89,27 @@ func NewRootCmd(version, date string, p *print.Printer) *cobra.Command {
8889 c .Flags ().BoolP ("help" , "h" , false , fmt .Sprintf ("Help for %q" , c .CommandPath ()))
8990 })
9091
92+ beautifyUsageTemplate (cmd )
93+
9194 return cmd
9295}
9396
97+ func beautifyUsageTemplate (cmd * cobra.Command ) {
98+ cobra .AddTemplateFunc ("WhiteBold" , color .New (color .FgHiWhite , color .Bold ).SprintFunc ())
99+ usageTemplate := cmd .UsageTemplate ()
100+ usageTemplate = strings .NewReplacer (
101+ `Usage:` , `{{WhiteBold "USAGE"}}` ,
102+ `Examples:` , `{{WhiteBold "EXAMPLES"}}` ,
103+ `Aliases:` , `{{WhiteBold "ALIASES"}}` ,
104+ `Available Commands:` , `{{WhiteBold "AVAILABLE COMMANDS"}}` ,
105+ `Additional Commands:` , `{{WhiteBold "ADDITIONAL COMMANDS"}}` ,
106+ `Global Flags:` , `{{WhiteBold "GLOBAL FLAGS"}}` ,
107+ `Flags:` , `{{WhiteBold "FLAGS"}}` ,
108+ `Additional help topics:` , `{{WhiteBold "ADDITIONAL HELP TOPICS"}}` ,
109+ ).Replace (usageTemplate )
110+ cmd .SetUsageTemplate (usageTemplate )
111+ }
112+
94113func configureFlags (cmd * cobra.Command ) error {
95114 cmd .Flags ().BoolP ("version" , "v" , false , `Show "stackit" version` )
96115
0 commit comments