Skip to content

Commit

Permalink
the token-code is always taken from the argument
Browse files Browse the repository at this point in the history
  • Loading branch information
d-tsuji committed Mar 6, 2021
1 parent 063bd81 commit a9cb379
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 12 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ $ awsmfa [options] [token-code]
--serial-number string
AWS serial number. `--serial-number` is required
--token-code string
Device token codes issued by the MFA. `--token-code` option or `token-code` is required
--quiet bool
if enabled, log is not printed in the console. (default `false`)
```
Expand Down
4 changes: 0 additions & 4 deletions cmd/awsmfa/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ func main() {
Name: "serial-number",
Usage: "AWS serial-number",
},
&cli.StringFlag{
Name: "token-code",
Usage: "AWS MFA token",
},
&cli.BoolFlag{
Name: "quiet",
Usage: "log print disable",
Expand Down
7 changes: 2 additions & 5 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,9 @@ func NewConfig(c *cli.Context) (*Config, error) {
return nil, errors.New("--serial-number is required")
}

mfaTokenCode := c.String("token-code")
mfaTokenCode := c.Args().First()
if mfaTokenCode == "" {
mfaTokenCode = c.Args().First()
}
if mfaTokenCode == "" {
return nil, errors.New("--token-code or token arguments is required")
return nil, errors.New("[token-code] arguments is required")
}

client := sts.New(session.Must(session.NewSessionWithOptions(session.Options{
Expand Down

0 comments on commit a9cb379

Please sign in to comment.