From a06217a8bdbb2cf3c794f297f6fa73e5910151ca Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Mon, 19 Dec 2022 10:01:43 -0800 Subject: [PATCH] cmd/tailscale/cli: hide Windows named pipe default name in flag help It's long & distracting for how low value it is. Fixes #6766 Change-Id: I51364f25c0088d9e63deb9f692ba44031f12251b Signed-off-by: Brad Fitzpatrick --- cmd/tailscale/cli/cli.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cmd/tailscale/cli/cli.go b/cmd/tailscale/cli/cli.go index d5a121af7..984e0762b 100644 --- a/cmd/tailscale/cli/cli.go +++ b/cmd/tailscale/cli/cli.go @@ -142,7 +142,7 @@ func Run(args []string) (err error) { }) rootfs := newFlagSet("tailscale") - rootfs.StringVar(&rootArgs.socket, "socket", paths.DefaultTailscaledSocket(), "path to tailscaled's unix socket") + rootfs.StringVar(&rootArgs.socket, "socket", paths.DefaultTailscaledSocket(), "path to tailscaled socket") rootCmd := &ffcli.Command{ Name: "tailscale", @@ -297,7 +297,14 @@ func usageFuncOpt(c *ffcli.Command, withDefaults bool) string { s += "\n \t" s += strings.ReplaceAll(usage, "\n", "\n \t") - if f.DefValue != "" && withDefaults { + showDefault := f.DefValue != "" && withDefaults + // Issue 6766: don't show the default Windows socket path. It's long + // and distracting. And people on on Windows aren't likely to ever + // change it anyway. + if runtime.GOOS == "windows" && f.Name == "socket" && strings.HasPrefix(f.DefValue, `\\.\pipe\ProtectedPrefix\`) { + showDefault = false + } + if showDefault { s += fmt.Sprintf(" (default %s)", f.DefValue) }