fix exit code
This commit is contained in:
parent
085f31fed8
commit
48bc79a291
2 changed files with 4 additions and 7 deletions
|
|
@ -189,7 +189,7 @@ func statusRun(opts *StatusOptions) error {
|
|||
|
||||
if opts.ShowToken && opts.Exporter != nil {
|
||||
fmt.Fprintf(stderr, "`--json` and `--show-token` cannot be used together. To include the token in the JSON output, use `--json token`.")
|
||||
return cmdutil.SilentError
|
||||
return nil
|
||||
}
|
||||
|
||||
statuses := make(map[string]Entries)
|
||||
|
|
@ -200,6 +200,7 @@ func statusRun(opts *StatusOptions) error {
|
|||
"You are not logged into any GitHub hosts. To log in, run: %s\n", cs.Bold("gh auth login"))
|
||||
if opts.Exporter != nil {
|
||||
opts.Exporter.Write(opts.IO, struct{}{})
|
||||
return nil
|
||||
}
|
||||
return cmdutil.SilentError
|
||||
}
|
||||
|
|
@ -209,6 +210,7 @@ func statusRun(opts *StatusOptions) error {
|
|||
"You are not logged into any accounts on %s\n", opts.Hostname)
|
||||
if opts.Exporter != nil {
|
||||
opts.Exporter.Write(opts.IO, struct{}{})
|
||||
return nil
|
||||
}
|
||||
return cmdutil.SilentError
|
||||
}
|
||||
|
|
@ -283,7 +285,7 @@ func statusRun(opts *StatusOptions) error {
|
|||
}
|
||||
|
||||
opts.Exporter.Write(opts.IO, statusesForExport)
|
||||
return err
|
||||
return nil
|
||||
}
|
||||
|
||||
prevEntry := false
|
||||
|
|
|
|||
|
|
@ -550,7 +550,6 @@ func Test_statusRun(t *testing.T) {
|
|||
opts: StatusOptions{
|
||||
Exporter: defaultJsonExporter(),
|
||||
},
|
||||
wantErr: cmdutil.SilentError,
|
||||
wantOut: "{}\n",
|
||||
wantErrOut: "You are not logged into any GitHub hosts. To log in, run: gh auth login\n",
|
||||
},
|
||||
|
|
@ -563,7 +562,6 @@ func Test_statusRun(t *testing.T) {
|
|||
cfgStubs: func(t *testing.T, c gh.Config) {
|
||||
login(t, c, "github.com", "monalisa", "gho_abc123", "https")
|
||||
},
|
||||
wantErr: cmdutil.SilentError,
|
||||
wantOut: "{}\n",
|
||||
wantErrOut: "You are not logged into any accounts on foo.com\n",
|
||||
},
|
||||
|
|
@ -634,7 +632,6 @@ func Test_statusRun(t *testing.T) {
|
|||
// mock for HeaderHasMinimumScopes api requests to a non-github.com host
|
||||
reg.Register(httpmock.REST("GET", "api/v3/"), httpmock.StatusStringResponse(400, "no bueno"))
|
||||
},
|
||||
wantErr: cmdutil.SilentError,
|
||||
wantOut: `{"ghe.io":[{"active":true,"host":"ghe.io","login":"monalisa-ghe","scopes":"","state":"error"}]}` + "\n",
|
||||
},
|
||||
{
|
||||
|
|
@ -652,7 +649,6 @@ func Test_statusRun(t *testing.T) {
|
|||
return nil, context.DeadlineExceeded
|
||||
})
|
||||
},
|
||||
wantErr: cmdutil.SilentError,
|
||||
wantOut: `{"github.com":[{"active":true,"host":"github.com","login":"monalisa","scopes":"","state":"timeout"}]}` + "\n",
|
||||
},
|
||||
{
|
||||
|
|
@ -664,7 +660,6 @@ func Test_statusRun(t *testing.T) {
|
|||
cfgStubs: func(t *testing.T, c gh.Config) {
|
||||
login(t, c, "github.com", "monalisa", "abc123", "https")
|
||||
},
|
||||
wantErr: cmdutil.SilentError,
|
||||
wantErrOut: "`--json` and `--show-token` cannot be used together. To include the token in the JSON output, use `--json token`.",
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue