2016-07-22 18:15:38 +00:00
|
|
|
// Copyright 2010 The Go Authors. All rights reserved.
|
2011-01-21 18:19:03 +00: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.
|
|
|
|
|
|
|
|
// ResetForTesting clears all flag state and sets the usage function as directed.
|
2011-09-16 15:47:21 +00:00
|
|
|
// After calling ResetForTesting, parse errors in flag handling will not
|
|
|
|
// exit the program.
|
2011-01-21 18:19:03 +00:00
|
|
|
func ResetForTesting(usage func()) {
|
2013-11-06 19:49:01 +00:00
|
|
|
CommandLine = NewFlagSet(os.Args[0], ContinueOnError)
|
2011-01-21 18:19:03 +00:00
|
|
|
Usage = usage
|
|
|
|
}
|