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 <ahmetalpbalkan@gmail.com>
This commit is contained in:
parent
c7bac5a484
commit
718f112173
1 changed files with 4 additions and 8 deletions
|
@ -506,15 +506,11 @@ func Set(name, value string) error {
|
||||||
// otherwise, the default values of all defined flags in the set.
|
// otherwise, the default values of all defined flags in the set.
|
||||||
func (f *FlagSet) PrintDefaults() {
|
func (f *FlagSet) PrintDefaults() {
|
||||||
writer := tabwriter.NewWriter(f.Out(), 20, 1, 3, ' ', 0)
|
writer := tabwriter.NewWriter(f.Out(), 20, 1, 3, ' ', 0)
|
||||||
var home string
|
home := homedir.Get()
|
||||||
if runtime.GOOS != "windows" {
|
|
||||||
// Only do this on non-windows systems
|
|
||||||
home = homedir.Get()
|
|
||||||
|
|
||||||
// Don't substitute when HOME is /
|
// Don't substitute when HOME is /
|
||||||
if home == "/" {
|
if runtime.GOOS != "windows" && home == "/" {
|
||||||
home = ""
|
home = ""
|
||||||
}
|
|
||||||
}
|
}
|
||||||
f.VisitAll(func(flag *Flag) {
|
f.VisitAll(func(flag *Flag) {
|
||||||
format := " -%s=%s"
|
format := " -%s=%s"
|
||||||
|
|
Loading…
Add table
Reference in a new issue