Commit c07c9dd4 authored by Chao Xu's avatar Chao Xu

let --version flag be treated as --version=true

parent 2c498937
......@@ -74,6 +74,8 @@ func (v *versionValue) Type() string {
func VersionVar(p *versionValue, name string, value versionValue, usage string) {
*p = value
flag.Var(p, name, usage)
// "--version" will be treated as "--version=true"
flag.Lookup(name).NoOptDefVal = "true"
}
func Version(name string, value versionValue, usage string) *versionValue {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment