Browse Source
add -j flag to display json instead of QRCode
make_cert_optional
Otto Suess
7 years ago
No known key found for this signature in database
GPG Key ID: 354749C62B4BAC41
1 changed files with
10 additions and
2 deletions
-
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() |
|
|
|
} |
|
|
|
} |
|
|
|