Skip to content

Commit

Permalink
feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
pcarrier committed Aug 1, 2021
1 parent 2a76036 commit a43ce65
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions gauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ func main() {

cfgPath := os.Getenv("GAUTH_CONFIG")
if cfgPath == "" {
usr, err := user.Current()
u, err := user.Current()
if err != nil {
log.Fatal(err)
}
cfgPath = path.Join(usr.HomeDir, ".config/gauth.csv")
cfgPath = path.Join(u.HomeDir, ".config/gauth.csv")
}

cfgContent, err := gauth.LoadConfigFile(cfgPath, getPassword)
Expand All @@ -54,15 +54,18 @@ func main() {
cw := csv.NewWriter(os.Stdout)
for _, record := range cfg {
name, secret := record[0], record[1]
_, curr, next, err := gauth.Codes(secret, currentTS)
prev, curr, next, err := gauth.Codes(secret, currentTS)
if err != nil {
log.Fatalf("Generating codes: %v", err)
}
if err := cw.Write([]string{name, curr, next, strconv.Itoa(30 - progress)}); err != nil {
if err := cw.Write([]string{name, curr, next, prev, strconv.Itoa(30 - progress)}); err != nil {
log.Fatalf("Printing CSV: %v", err)
}
}
cw.Flush()
if (err := cw.Error()) {
log.Fatalf("Flushing: %v", err)
}
} else {
tw := tabwriter.NewWriter(os.Stdout, 0, 8, 1, ' ', 0)
if _, err := fmt.Fprintln(tw, "\tprev\tcurr\tnext"); err != nil {
Expand Down

0 comments on commit a43ce65

Please sign in to comment.