Browse Source

add -j flag to display json instead of QRCode

make_cert_optional
Otto Suess 7 years ago
parent
commit
029a0bc0e3
No known key found for this signature in database GPG Key ID: 354749C62B4BAC41
  1. 12
      zapconnect.go

12
zapconnect.go

@ -1,6 +1,7 @@
package main
import (
"flag"
"fmt"
"io/ioutil"
"github.com/Baozisoftware/qrcode-terminal-go"
@ -33,6 +34,13 @@ func main() {
Macaroon: sEnc}
certB, _ := json.Marshal(cert)
obj := qrcodeTerminal.New()
obj.Get(string(certB)).Print()
jsonPtr := flag.Bool("j", false, "Generate json instead of a QRCode.")
flag.Parse()
if *jsonPtr {
fmt.Print(string(certB))
} else {
obj := qrcodeTerminal.New()
obj.Get(string(certB)).Print()
}
}

Loading…
Cancel
Save