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
4a6aec64
Commit
4a6aec64
authored
Jan 21, 2015
by
Matt Bell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commands: request: Added Values map
parent
8ca8d6ef
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletion
+8
-1
commands/request.go
commands/request.go
+8
-1
No files found.
commands/request.go
View file @
4a6aec64
...
...
@@ -77,6 +77,7 @@ type Request interface {
Context
()
*
Context
SetContext
(
Context
)
Command
()
*
Command
Values
()
map
[
string
]
interface
{}
ConvertOptions
()
error
}
...
...
@@ -89,6 +90,7 @@ type request struct {
cmd
*
Command
ctx
Context
optionDefs
map
[
string
]
Option
values
map
[
string
]
interface
{}
}
// Path returns the command path of this request
...
...
@@ -208,6 +210,10 @@ var converters = map[reflect.Kind]converter{
},
}
func
(
r
*
request
)
Values
()
map
[
string
]
interface
{}
{
return
r
.
values
}
func
(
r
*
request
)
ConvertOptions
()
error
{
for
k
,
v
:=
range
r
.
options
{
opt
,
ok
:=
r
.
optionDefs
[
k
]
...
...
@@ -275,7 +281,8 @@ func NewRequest(path []string, opts optMap, args []string, file files.File, cmd
}
ctx
:=
Context
{
Context
:
context
.
TODO
()}
req
:=
&
request
{
path
,
opts
,
args
,
file
,
cmd
,
ctx
,
optDefs
}
values
:=
make
(
map
[
string
]
interface
{})
req
:=
&
request
{
path
,
opts
,
args
,
file
,
cmd
,
ctx
,
optDefs
,
values
}
err
:=
req
.
ConvertOptions
()
if
err
!=
nil
{
return
nil
,
err
...
...
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