make sure the examples execute

Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
diff --git a/cli/example_action_test.go b/cli/example_action_test.go
index 5cd38ae..b800b5a 100644
--- a/cli/example_action_test.go
+++ b/cli/example_action_test.go
@@ -8,10 +8,29 @@
 	"os"
 	"os/signal"
 	"syscall"
+	"testing"
 
 	"github.com/genuinetools/pkg/cli"
 )
 
+func TestMain(m *testing.M) {
+	flag.Parse()
+	resetForTesting()
+	os.Exit(m.Run())
+}
+
+var defaultUsage = flag.Usage
+
+// resetTesting clears all flag state and sets the usage function as directed.
+// After calling resetForTesting, parse errors in flag handling will not
+// exit the program.
+// It also resets the args passed.
+func resetForTesting() {
+	flag.CommandLine = flag.NewFlagSet(os.Args[0], flag.ContinueOnError)
+	flag.CommandLine.Usage = defaultUsage
+	os.Args = []string{"yo", "yo"}
+}
+
 func ExampleNewProgram_withSingleAction() {
 	// Create a new cli program.
 	p := cli.NewProgram()
@@ -58,5 +77,5 @@
 
 	// Run our program.
 	p.Run()
-
+	// Output: yo
 }
diff --git a/cli/example_command_test.go b/cli/example_command_test.go
index 0545bf9..5dfccdb 100644
--- a/cli/example_command_test.go
+++ b/cli/example_command_test.go
@@ -60,5 +60,5 @@
 
 	// Run our program.
 	p.Run()
-
+	// Output: yo
 }