summaryrefslogtreecommitdiff
path: root/go/internal/command
diff options
context:
space:
mode:
Diffstat (limited to 'go/internal/command')
-rw-r--r--go/internal/command/discover/discover.go10
-rw-r--r--go/internal/command/twofactorrecover/twofactorrecover.go6
-rw-r--r--go/internal/command/twofactorrecover/twofactorrecover_test.go2
3 files changed, 3 insertions, 15 deletions
diff --git a/go/internal/command/discover/discover.go b/go/internal/command/discover/discover.go
index 9b53a51..9bb442f 100644
--- a/go/internal/command/discover/discover.go
+++ b/go/internal/command/discover/discover.go
@@ -35,13 +35,5 @@ func (c *Command) getUserInfo() (*discover.Response, error) {
return nil, err
}
- if c.Args.GitlabKeyId != "" {
- return client.GetByKeyId(c.Args.GitlabKeyId)
- } else if c.Args.GitlabUsername != "" {
- return client.GetByUsername(c.Args.GitlabUsername)
- } else {
- // There was no 'who' information, this matches the ruby error
- // message.
- return nil, fmt.Errorf("who='' is invalid")
- }
+ return client.GetByCommandArgs(c.Args)
}
diff --git a/go/internal/command/twofactorrecover/twofactorrecover.go b/go/internal/command/twofactorrecover/twofactorrecover.go
index 227f462..e77a334 100644
--- a/go/internal/command/twofactorrecover/twofactorrecover.go
+++ b/go/internal/command/twofactorrecover/twofactorrecover.go
@@ -54,15 +54,11 @@ func (c *Command) displayRecoveryCodes(readWriter *readwriter.ReadWriter) {
}
func (c *Command) getRecoveryCodes() ([]string, error) {
- if c.Args.GitlabKeyId == "" {
- return nil, fmt.Errorf("Failed to get key id")
- }
-
client, err := twofactorrecover.NewClient(c.Config)
if err != nil {
return nil, err
}
- return client.GetRecoveryCodes(c.Args.GitlabKeyId)
+ return client.GetRecoveryCodes(c.Args)
}
diff --git a/go/internal/command/twofactorrecover/twofactorrecover_test.go b/go/internal/command/twofactorrecover/twofactorrecover_test.go
index a005af9..908ee13 100644
--- a/go/internal/command/twofactorrecover/twofactorrecover_test.go
+++ b/go/internal/command/twofactorrecover/twofactorrecover_test.go
@@ -108,7 +108,7 @@ func TestExecute(t *testing.T) {
desc: "With missing arguments",
arguments: &commandargs.CommandArgs{},
answer: "yes\n",
- expectedOutput: question + errorHeader + "Failed to get key id\n",
+ expectedOutput: question + errorHeader + "who='' is invalid\n",
},
{
desc: "With negative answer",