From a9cb3799a0bfe117487ff9234a863093e9d4d2f5 Mon Sep 17 00:00:00 2001 From: d-tsuji Date: Sat, 6 Mar 2021 18:45:44 +0900 Subject: [PATCH] the token-code is always taken from the argument --- README.md | 3 --- cmd/awsmfa/main.go | 4 ---- config.go | 7 ++----- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 940c139..ca0d5e3 100644 --- a/README.md +++ b/README.md @@ -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`) ``` diff --git a/cmd/awsmfa/main.go b/cmd/awsmfa/main.go index d6e4855..c9a6fdf 100644 --- a/cmd/awsmfa/main.go +++ b/cmd/awsmfa/main.go @@ -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", diff --git a/config.go b/config.go index baaa405..815ab05 100644 --- a/config.go +++ b/config.go @@ -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{