@@ -17,8 +17,10 @@ import (
17
17
"golang.org/x/crypto/ssh/terminal"
18
18
"golang.org/x/xerrors"
19
19
20
+ "github.com/coder/coder/v2/buildinfo"
20
21
"github.com/coder/coder/v2/cli/clibase"
21
22
"github.com/coder/coder/v2/cli/cliui"
23
+ "github.com/coder/pretty"
22
24
)
23
25
24
26
//go:embed help.tpl
@@ -47,12 +49,21 @@ func wrapTTY(s string) string {
47
49
var usageTemplate = template .Must (
48
50
template .New ("usage" ).Funcs (
49
51
template.FuncMap {
52
+ "nameVersion" : func () string {
53
+ txt := pretty .String ("coder" )
54
+ pretty .FgColor (cliui .Green ).Format (txt )
55
+ txt .Append (" " , buildinfo .Version ())
56
+ return txt .String ()
57
+ },
50
58
"wrapTTY" : func (s string ) string {
51
59
return wrapTTY (s )
52
60
},
53
61
"trimNewline" : func (s string ) string {
54
62
return strings .TrimSuffix (s , "\n " )
55
63
},
64
+ "keyword" : func (s string ) string {
65
+ return cliui .Keyword (s )
66
+ },
56
67
"typeHelper" : func (opt * clibase.Option ) string {
57
68
switch v := opt .Value .(type ) {
58
69
case * clibase.Enum :
@@ -127,7 +138,9 @@ var usageTemplate = template.Must(
127
138
return opt .Flag
128
139
},
129
140
"prettyHeader" : func (s string ) string {
130
- return cliui .Bold (s )
141
+ return pretty .Sprint (
142
+ pretty .FgColor (cliui .Gold ), strings .ToUpper (s ), ":" ,
143
+ )
131
144
},
132
145
"isEnterprise" : func (opt clibase.Option ) bool {
133
146
return opt .Annotations .IsSet ("enterprise" )
0 commit comments