Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-unixfs
Commits
3255bb02
Commit
3255bb02
authored
Nov 08, 2014
by
Matt Bell
Committed by
Juan Batiz-Benet
Nov 14, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commands/cli: Output command path in Parse
parent
c827573e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
commands/cli/parse.go
commands/cli/parse.go
+6
-6
No files found.
commands/cli/parse.go
View file @
3255bb02
...
...
@@ -11,7 +11,7 @@ import (
// Parse parses the input commandline string (cmd, flags, and args).
// returns the corresponding command Request object.
func
Parse
(
input
[]
string
,
roots
...*
cmds
.
Command
)
(
cmds
.
Request
,
*
cmds
.
Command
,
*
cmds
.
Command
,
error
)
{
func
Parse
(
input
[]
string
,
roots
...*
cmds
.
Command
)
(
cmds
.
Request
,
*
cmds
.
Command
,
*
cmds
.
Command
,
[]
string
,
error
)
{
var
root
,
cmd
*
cmds
.
Command
var
path
,
stringArgs
[]
string
var
opts
map
[
string
]
interface
{}
...
...
@@ -22,7 +22,7 @@ func Parse(input []string, roots ...*cmds.Command) (cmds.Request, *cmds.Command,
p
,
i
,
c
:=
parsePath
(
input
,
r
)
o
,
s
,
err
:=
parseOptions
(
i
)
if
err
!=
nil
{
return
nil
,
root
,
c
,
err
return
nil
,
root
,
c
,
p
,
err
}
length
:=
len
(
p
)
...
...
@@ -37,22 +37,22 @@ func Parse(input []string, roots ...*cmds.Command) (cmds.Request, *cmds.Command,
}
if
maxLength
==
0
{
return
nil
,
root
,
nil
,
errors
.
New
(
"Not a valid subcommand"
)
return
nil
,
root
,
nil
,
path
,
errors
.
New
(
"Not a valid subcommand"
)
}
args
,
err
:=
parseArgs
(
stringArgs
,
cmd
)
if
err
!=
nil
{
return
nil
,
root
,
cmd
,
err
return
nil
,
root
,
cmd
,
path
,
err
}
req
:=
cmds
.
NewRequest
(
path
,
opts
,
args
,
cmd
)
err
=
cmd
.
CheckArguments
(
req
)
if
err
!=
nil
{
return
nil
,
root
,
cmd
,
err
return
req
,
root
,
cmd
,
path
,
err
}
return
req
,
root
,
cmd
,
nil
return
req
,
root
,
cmd
,
path
,
nil
}
// parsePath separates the command path and the opts and args from a command string
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment