From 718f1121736fdc3d1df8821793baa079d5c1606f Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Wed, 11 Mar 2015 02:14:49 -0700 Subject: [PATCH] Make use of %USERPROFILE% in cli help message An earlier commit was causing docker windows CLI build to not to pick up the shorthand form for home directory (`%USERPROFILE%`) shown in when `docker --help` is executed. Fixing that bug and making the if statement concise and clear. Signed-off-by: Ahmet Alp Balkan --- mflag/flag.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/mflag/flag.go b/mflag/flag.go index d02c7b1..b35692b 100644 --- a/mflag/flag.go +++ b/mflag/flag.go @@ -506,15 +506,11 @@ func Set(name, value string) error { // otherwise, the default values of all defined flags in the set. func (f *FlagSet) PrintDefaults() { writer := tabwriter.NewWriter(f.Out(), 20, 1, 3, ' ', 0) - var home string - if runtime.GOOS != "windows" { - // Only do this on non-windows systems - home = homedir.Get() + home := homedir.Get() - // Don't substitute when HOME is / - if home == "/" { - home = "" - } + // Don't substitute when HOME is / + if runtime.GOOS != "windows" && home == "/" { + home = "" } f.VisitAll(func(flag *Flag) { format := " -%s=%s"