Skip to content

Commit

Permalink
make posix style flags
Browse files Browse the repository at this point in the history
  • Loading branch information
rxbn committed Apr 22, 2021
1 parent 550720e commit 789b30c
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 6 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## [v2.0.0](https://github.com/containeroo/otpgen/tree/v2.0.0) (2021-04-22)

[All Commits](https://github.com/containeroo/otpgen/compare/v1.0.0...v2.0.0)

**Caution!** The flags have changed since v1.0.0! Please refer to the readme file for more information.

**New features:**

- use POSIX/GNU-style `--flags`

## [v1.0.0](https://github.com/containeroo/otpgen/tree/v1.0.0) (2021-04-14)

Initial release
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ A small cli tool to generate TOTP (Time-based One-time Password) tokens.

```
Usage of otpgen:
-secretKey string
supply a valid TOTP secret key to generate a token from
-s, --secretkey string supply a valid TOTP secret key to generate a token from
```
5 changes: 4 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ module github.com/containeroo/otpgen

go 1.16

require github.com/xlzd/gotp v0.0.0-20181030022105-c8557ba2c119
require (
github.com/spf13/pflag v1.0.5
github.com/xlzd/gotp v0.0.0-20181030022105-c8557ba2c119
)
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/xlzd/gotp v0.0.0-20181030022105-c8557ba2c119 h1:YyPWX3jLOtYKulBR6AScGIs74lLrJcgeKRwcbAuQOG4=
github.com/xlzd/gotp v0.0.0-20181030022105-c8557ba2c119/go.mod h1:/nuTSlK+okRfR/vnIPqR89fFKonnWPiZymN5ydRJkX8=
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package main

import (
"flag"
"fmt"
flag "github.com/spf13/pflag"
"github.com/xlzd/gotp"
"log"
)

func main() {
secretKey := flag.String("secretKey", "", "supply a valid TOTP secret key to generate a token from")
secretKey := flag.StringP("secretkey", "s","", "supply a valid TOTP secret key to generate a token from")
flag.Parse()
if *secretKey == "" {
log.Fatal("secretKey cannot be empty")
log.Fatal("secretkey cannot be empty")
}
fmt.Print(gotp.NewDefaultTOTP(*secretKey).Now())
}
Binary file added otpgen
Binary file not shown.

0 comments on commit 789b30c

Please sign in to comment.