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

Loading…
Cancel
Save