From 4986600e5455ce98f1cddf79da1915399c47e26a Mon Sep 17 00:00:00 2001
From: Juan Batiz-Benet <juan@benet.ai>
Date: Mon, 20 Oct 2014 07:59:19 -0700
Subject: [PATCH] parsePath no err

---
 commands/cli/parse.go      | 10 +++-------
 commands/cli/parse_test.go |  5 +----
 2 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/commands/cli/parse.go b/commands/cli/parse.go
index a58298f17..23a7e1976 100644
--- a/commands/cli/parse.go
+++ b/commands/cli/parse.go
@@ -10,11 +10,7 @@ import (
 // Parse parses the input commandline string (cmd, flags, and args).
 // returns the corresponding command Request object.
 func Parse(input []string, root *commands.Command) (*commands.Request, error) {
-	path, input, err := parsePath(input, root)
-	if err != nil {
-		return nil, err
-	}
-
+	path, input := parsePath(input, root)
 	opts, args, err := parseOptions(input)
 	if err != nil {
 		return nil, err
@@ -24,7 +20,7 @@ func Parse(input []string, root *commands.Command) (*commands.Request, error) {
 }
 
 // parsePath gets the command path from the command line input
-func parsePath(input []string, root *commands.Command) ([]string, []string, error) {
+func parsePath(input []string, root *commands.Command) ([]string, []string) {
 	cmd := root
 	i := 0
 
@@ -41,7 +37,7 @@ func parsePath(input []string, root *commands.Command) ([]string, []string, erro
 		i++
 	}
 
-	return input[:i], input[i:], nil
+	return input[:i], input[i:]
 }
 
 // parseOptions parses the raw string values of the given options
diff --git a/commands/cli/parse_test.go b/commands/cli/parse_test.go
index caa82c1d0..dffc4b143 100644
--- a/commands/cli/parse_test.go
+++ b/commands/cli/parse_test.go
@@ -35,10 +35,7 @@ func TestOptionParsing(t *testing.T) {
 		t.Error("Should have failed (duplicate option name)")
 	}
 
-	path, args, err := parsePath([]string{"test", "beep", "boop"}, cmd)
-	if err != nil {
-		t.Error("Should have passed")
-	}
+	path, args := parsePath([]string{"test", "beep", "boop"}, cmd)
 	if len(path) != 1 || path[0] != "test" {
 		t.Error("Returned path was defferent than expected: %v", path)
 	}
-- 
GitLab