fix version command

Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
diff --git a/cli/cli.go b/cli/cli.go
index a9a5ce7..3286613 100644
--- a/cli/cli.go
+++ b/cli/cli.go
@@ -104,6 +104,9 @@
 }
 
 func (p *Program) run(ctx context.Context, args []string) (bool, error) {
+	// Append the version command to the list of commands by default.
+	p.Commands = append(p.Commands, &versionCommand{})
+
 	// TODO(jessfraz): Find a better way to tell that they passed -h through as a flag.
 	if len(args) > 1 &&
 		(strings.Contains(strings.ToLower(args[1]), "help") ||
@@ -114,13 +117,10 @@
 
 	// If we do not have an action set and we have no commands, print the usage
 	// and exit.
-	if p.Action == nil && len(p.Commands) < 1 {
+	if p.Action == nil && len(p.Commands) < 2 {
 		return true, nil
 	}
 
-	// Append the version command to the list of commands by default.
-	p.Commands = append(p.Commands, &versionCommand{})
-
 	// Check if the command exists.
 	var commandExists bool
 	if len(args) > 1 && in(args[1], p.Commands) {
diff --git a/cli/cli_test.go b/cli/cli_test.go
index ef7f040..ab6b4d2 100644
--- a/cli/cli_test.go
+++ b/cli/cli_test.go
@@ -60,6 +60,7 @@
 	testCases := []struct {
 		description string
 		args        []string
+		expectedErr error
 	}{
 		{
 			description: "nil",
@@ -75,15 +76,14 @@
 		{
 			description: "args: foo bar",
 			args:        []string{"foo", "bar"},
+			expectedErr: errors.New("bar: no such command"),
 		},
 	}
 
 	for _, tc := range testCases {
 		t.Run(tc.description, func(t *testing.T) {
 			printUsage, err := p.run(context.Background(), tc.args)
-			if err != nil {
-				t.Fatalf("expected no error, got: %v", err)
-			}
+			compareErrors(t, err, tc.expectedErr)
 
 			if !printUsage {
 				t.Fatal("expected behavior was to print the usage")