dont run Before function on version command

Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
diff --git a/cli/cli.go b/cli/cli.go
index f17233b..b29c3f4 100644
--- a/cli/cli.go
+++ b/cli/cli.go
@@ -176,7 +176,9 @@
 				return false, flag.ErrHelp
 			}
 
-			if p.Before != nil {
+			// Only execute the Before function for user-supplied commands.
+			// This excludes the version command we supply.
+			if p.Before != nil && command.Name() != "version" {
 				if err := p.Before(ctx); err != nil {
 					return false, err
 				}
diff --git a/cli/cli_test.go b/cli/cli_test.go
index 8a360a1..cbd9752 100644
--- a/cli/cli_test.go
+++ b/cli/cli_test.go
@@ -8,6 +8,7 @@
 	"fmt"
 	"io"
 	"os"
+	"runtime"
 	"strings"
 	"testing"
 )
@@ -44,17 +45,22 @@
 		return errExpected
 	}
 
-	versionExpected = "ship:\n version"
+	versionCommandExpectedStdout = fmt.Sprintf(`ship:
+ version     : 0.0.0
+ git hash    :`+" "+`
+ go version  : %s
+ go compiler : %s
+ platform    : %s/%s
+`, runtime.Version(), runtime.Compiler, runtime.GOOS, runtime.GOARCH)
 )
 
 type testCase struct {
-	description        string
-	args               []string
-	shouldPrintUsage   bool
-	shouldPrintVersion bool
-	expectedErr        error
-	expectedStderr     string
-	expectedStdout     string
+	description      string
+	args             []string
+	shouldPrintUsage bool
+	expectedErr      error
+	expectedStderr   string
+	expectedStdout   string
 }
 
 // Define the testCommand.
@@ -141,19 +147,19 @@
 			expectedErr: errExpectedFromCommand,
 		},
 		{
-			description:        "args: foo version",
-			args:               []string{"foo", "version"},
-			shouldPrintVersion: true,
+			description:    "args: foo version",
+			args:           []string{"foo", "version"},
+			expectedStdout: versionCommandExpectedStdout,
 		},
 		{
-			description:        "args: foo version foo",
-			args:               []string{"foo", "version", "foo"},
-			shouldPrintVersion: true,
+			description:    "args: foo version foo",
+			args:           []string{"foo", "version", "foo"},
+			expectedStdout: versionCommandExpectedStdout,
 		},
 		{
-			description:        "args: foo version foo bar",
-			args:               []string{"foo", "version", "foo", "bar"},
-			shouldPrintVersion: true,
+			description:    "args: foo version foo bar",
+			args:           []string{"foo", "version", "foo", "bar"},
+			expectedStdout: versionCommandExpectedStdout,
 		},
 	}
 }
@@ -589,15 +595,9 @@
 		t.Fatalf("expected no stderr, got: %s", stderr)
 	}
 
-	// IF
-	// we DON'T EXPECT and error on Before
-	// AND
-	// we EXPECT the version to be printed
-	// THEN
-	// check that the version was actually printed.
-	if !p.isErrorOnBefore() &&
-		tc.shouldPrintVersion && !strings.HasPrefix(stdout, versionExpected) {
-		t.Fatalf("expected output to start with %q, got %q", versionExpected, stdout)
+	// Check that the stdout is what we expected.
+	if !strings.HasPrefix(stdout, tc.expectedStdout) {
+		t.Fatalf("expected stdout: %q\ngot: %q", tc.expectedStdout, stdout)
 	}
 
 	// IF