From 6bdb0b3748b247a8c28532fcd78b60c1a7ec07db Mon Sep 17 00:00:00 2001 From: Alex Ogier Date: Thu, 26 Apr 2012 17:52:05 -0400 Subject: Copy the flag module from the go standard library --- export_test.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 export_test.go (limited to 'export_test.go') diff --git a/export_test.go b/export_test.go new file mode 100644 index 0000000..7b19080 --- /dev/null +++ b/export_test.go @@ -0,0 +1,22 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// 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. +// After calling ResetForTesting, parse errors in flag handling will not +// exit the program. +func ResetForTesting(usage func()) { + commandLine = NewFlagSet(os.Args[0], ContinueOnError) + Usage = usage +} + +// CommandLine returns the default FlagSet. +func CommandLine() *FlagSet { + return commandLine +} -- cgit v1.2.3