File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -81,11 +81,13 @@ func statusRun(opts *StatusOptions) error {
8181 apiClient := api .NewClientFromHTTP (httpClient )
8282
8383 var failed bool
84+ var isHostnameFound bool
8485
8586 for _ , hostname := range hostnames {
8687 if opts .Hostname != "" && opts .Hostname != hostname {
8788 continue
8889 }
90+ isHostnameFound = true
8991
9092 token , tokenSource , _ := cfg .GetWithSource (hostname , "oauth_token" )
9193 tokenIsWriteable := cfg .CheckWriteable (hostname , "oauth_token" ) == nil
@@ -139,6 +141,12 @@ func statusRun(opts *StatusOptions) error {
139141 // not to since I wanted this command to be read-only.
140142 }
141143
144+ if ! isHostnameFound {
145+ fmt .Fprintf (stderr ,
146+ "You are not logged into any GitHub hosts. Run %s to authenticate.\n " , cs .Bold (fmt .Sprintf ("gh auth login -h %s" , opts .Hostname )))
147+ return cmdutil .SilentError
148+ }
149+
142150 for _ , hostname := range hostnames {
143151 lines , ok := statusInfo [hostname ]
144152 if ! ok {
You can’t perform that action at this time.
0 commit comments