From f9919ba323417aabd56b33403fe4568669ba62b3 Mon Sep 17 00:00:00 2001 From: Rob Pike Date: Fri, 13 Nov 2009 13:15:18 -0800 Subject: [PATCH] Explain why -flag true does not work although -flag=true does. Fixes #139. R=iant CC=golang-dev https://golang.org/cl/154118 --- src/pkg/flag/flag.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pkg/flag/flag.go b/src/pkg/flag/flag.go index ff72c08e24..0471d126c0 100644 --- a/src/pkg/flag/flag.go +++ b/src/pkg/flag/flag.go @@ -31,8 +31,13 @@ Command line flag syntax: -flag -flag=x - -flag x + -flag x // non-boolean flags only One or two minus signs may be used; they are equivalent. + The last form is not permitted for boolean flags because the + meaning of the command + cmd -x * + will change if there is a file called 0, false, etc. You must + use the -flag=false form to turn off a boolean flag. Flag parsing stops just before the first non-flag argument ("-" is a non-flag argument) or after the terminator "--". -- 2.48.1