fix flag parsing

This commit is contained in:
AJ ONeal 2020-10-01 21:45:43 -06:00
parent f46e11257b
commit 94f22e1948
2 changed files with 12 additions and 3 deletions

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
/keypairs
/dist/
.DS_Store
.*.sw*

View File

@ -18,11 +18,15 @@ func main() {
return return
} }
// gen subcommand
args := os.Args[2:]
var privname string var privname string
var pubname string var pubname string
flag.StringVar(&privname, "o", "", "private key file (should have .jwk.json or pkcs8.pem extension)") flags := flag.NewFlagSet("gen", flag.ExitOnError)
flag.StringVar(&pubname, "pub", "", "public key file (should have .jwk.json or spki.pem extension)") flags.StringVar(&privname, "o", "", "private key file (should have .jwk.json or pkcs8.pem extension)")
flag.Parse() flags.StringVar(&pubname, "pub", "", "public key file (should have .jwk.json or spki.pem extension)")
flags.Parse(args)
priv := keypairs.NewDefaultPrivateKey() priv := keypairs.NewDefaultPrivateKey()
marshalPriv(priv, privname) marshalPriv(priv, privname)