2016-07-22 20:15:38 +02:00
|
|
|
// Copyright 2010 The Go Authors. All rights reserved.
|
2011-01-21 19:19:03 +01:00
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
package flag
|
|
|
|
|
|
|
|
import "os"
|
|
|
|
|
|
|
|
// Additional routines compiled into the package only during testing.
|
|
|
|
|
2018-01-09 02:23:08 +01:00
|
|
|
var DefaultUsage = Usage
|
|
|
|
|
2011-01-21 19:19:03 +01:00
|
|
|
// ResetForTesting clears all flag state and sets the usage function as directed.
|
2011-09-16 17:47:21 +02:00
|
|
|
// After calling ResetForTesting, parse errors in flag handling will not
|
|
|
|
// exit the program.
|
2011-01-21 19:19:03 +01:00
|
|
|
func ResetForTesting(usage func()) {
|
2013-11-06 20:49:01 +01:00
|
|
|
CommandLine = NewFlagSet(os.Args[0], ContinueOnError)
|
2017-01-14 01:05:42 +01:00
|
|
|
CommandLine.Usage = commandLineUsage
|
2011-01-21 19:19:03 +01:00
|
|
|
Usage = usage
|
|
|
|
}
|