@@ -10,7 +10,6 @@ import (
1010 "github.com/cli/cli/internal/config"
1111 "github.com/cli/cli/pkg/cmdutil"
1212 "github.com/cli/cli/pkg/iostreams"
13- "github.com/cli/cli/utils"
1413 "github.com/spf13/cobra"
1514)
1615
@@ -64,12 +63,14 @@ func statusRun(opts *StatusOptions) error {
6463
6564 stderr := opts .IO .ErrOut
6665
66+ cs := opts .IO .ColorScheme ()
67+
6768 statusInfo := map [string ][]string {}
6869
6970 hostnames , err := cfg .Hosts ()
7071 if len (hostnames ) == 0 || err != nil {
7172 fmt .Fprintf (stderr ,
72- "You are not logged into any GitHub hosts. Run %s to authenticate.\n " , utils .Bold ("gh auth login" ))
73+ "You are not logged into any GitHub hosts. Run %s to authenticate.\n " , cs .Bold ("gh auth login" ))
7374 return cmdutil .SilentError
7475 }
7576
@@ -98,39 +99,39 @@ func statusRun(opts *StatusOptions) error {
9899 if err != nil {
99100 var missingScopes * api.MissingScopesError
100101 if errors .As (err , & missingScopes ) {
101- addMsg ("%s %s: the token in %s is %s" , utils .Red ("X" ), hostname , tokenSource , err )
102+ addMsg ("%s %s: the token in %s is %s" , cs .Red ("X" ), hostname , tokenSource , err )
102103 if tokenIsWriteable {
103104 addMsg ("- To request missing scopes, run: %s %s\n " ,
104- utils .Bold ("gh auth refresh -h" ),
105- utils .Bold (hostname ))
105+ cs .Bold ("gh auth refresh -h" ),
106+ cs .Bold (hostname ))
106107 }
107108 } else {
108- addMsg ("%s %s: authentication failed" , utils .Red ("X" ), hostname )
109- addMsg ("- The %s token in %s is no longer valid." , utils .Bold (hostname ), tokenSource )
109+ addMsg ("%s %s: authentication failed" , cs .Red ("X" ), hostname )
110+ addMsg ("- The %s token in %s is no longer valid." , cs .Bold (hostname ), tokenSource )
110111 if tokenIsWriteable {
111112 addMsg ("- To re-authenticate, run: %s %s" ,
112- utils .Bold ("gh auth login -h" ), utils .Bold (hostname ))
113+ cs .Bold ("gh auth login -h" ), cs .Bold (hostname ))
113114 addMsg ("- To forget about this host, run: %s %s" ,
114- utils .Bold ("gh auth logout -h" ), utils .Bold (hostname ))
115+ cs .Bold ("gh auth logout -h" ), cs .Bold (hostname ))
115116 }
116117 }
117118 failed = true
118119 } else {
119120 username , err := api .CurrentLoginName (apiClient , hostname )
120121 if err != nil {
121- addMsg ("%s %s: api call failed: %s" , utils .Red ("X" ), hostname , err )
122+ addMsg ("%s %s: api call failed: %s" , cs .Red ("X" ), hostname , err )
122123 }
123- addMsg ("%s Logged in to %s as %s (%s)" , utils . GreenCheck (), hostname , utils .Bold (username ), tokenSource )
124+ addMsg ("%s Logged in to %s as %s (%s)" , cs . SuccessIcon (), hostname , cs .Bold (username ), tokenSource )
124125 proto , _ := cfg .Get (hostname , "git_protocol" )
125126 if proto != "" {
126127 addMsg ("%s Git operations for %s configured to use %s protocol." ,
127- utils . GreenCheck (), hostname , utils .Bold (proto ))
128+ cs . SuccessIcon (), hostname , cs .Bold (proto ))
128129 }
129130 tokenDisplay := "*******************"
130131 if opts .ShowToken {
131132 tokenDisplay = token
132133 }
133- addMsg ("%s Token: %s" , utils . GreenCheck (), tokenDisplay )
134+ addMsg ("%s Token: %s" , cs . SuccessIcon (), tokenDisplay )
134135 }
135136 addMsg ("" )
136137
@@ -143,7 +144,7 @@ func statusRun(opts *StatusOptions) error {
143144 if ! ok {
144145 continue
145146 }
146- fmt .Fprintf (stderr , "%s\n " , utils .Bold (hostname ))
147+ fmt .Fprintf (stderr , "%s\n " , cs .Bold (hostname ))
147148 for _ , line := range lines {
148149 fmt .Fprintf (stderr , " %s\n " , line )
149150 }
0 commit comments