cmd/tailscale/cli: [up] compact QR code

Reduce QR code from 35 to 15 lines by using half-block characters,
disabling border and switching to negative.

See #6096 for potentially of reducing it further (11 lines)

Signed-off-by: Oren Tirosh <orent@hishome.net>
pull/8136/head
Oren Tirosh 2023-05-15 12:13:49 +03:00 committed by Denton Gentry
parent 07eacdfe92
commit 083878a094
No known key found for this signature in database
1 changed files with 2 additions and 1 deletions

View File

@ -636,10 +636,11 @@ func runUp(ctx context.Context, cmd string, args []string, upArgs upArgsT) (retE
fmt.Fprintf(Stderr, "\nTo authenticate, visit:\n\n\t%s\n\n", *url)
if upArgs.qr {
q, err := qrcode.New(*url, qrcode.Medium)
q.DisableBorder = true
if err != nil {
log.Printf("QR code error: %v", err)
} else {
fmt.Fprintf(Stderr, "%s\n", q.ToString(false))
fmt.Fprintf(Stderr, "%s\n", q.ToSmallString(true))
}
}
}