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
4911dc06
Commit
4911dc06
authored
Oct 29, 2014
by
Brian Tiger Chow
Committed by
Juan Batiz-Benet
Nov 04, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor(commands) swap argument order to match Http(w, r) idiom
parent
b1bf60b8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
commands/command.go
commands/command.go
+2
-2
commands/command_test.go
commands/command_test.go
+2
-2
No files found.
commands/command.go
View file @
4911dc06
...
...
@@ -12,7 +12,7 @@ var log = u.Logger("command")
// Function is the type of function that Commands use.
// It reads from the Request, and writes results to the Response.
type
Function
func
(
Re
quest
,
Response
)
type
Function
func
(
Re
sponse
,
Request
)
// Formatter is a function that takes in a Response, and returns a human-readable string
// (or an error on failure)
...
...
@@ -63,7 +63,7 @@ func (c *Command) Call(req Request) Response {
return
res
}
cmd
.
Run
(
re
q
,
re
s
)
cmd
.
Run
(
re
s
,
re
q
)
return
res
}
...
...
commands/command_test.go
View file @
4911dc06
...
...
@@ -8,7 +8,7 @@ func TestOptionValidation(t *testing.T) {
Option
{[]
string
{
"b"
,
"beep"
},
Int
},
Option
{[]
string
{
"B"
,
"boop"
},
String
},
},
Run
:
func
(
re
q
Re
quest
,
re
s
Re
sponse
)
{},
Run
:
func
(
re
s
Re
sponse
,
re
q
Re
quest
)
{},
}
req
:=
NewEmptyRequest
()
...
...
@@ -79,7 +79,7 @@ func TestOptionValidation(t *testing.T) {
}
func
TestRegistration
(
t
*
testing
.
T
)
{
noop
:=
func
(
re
q
Re
quest
,
re
s
Re
sponse
)
{}
noop
:=
func
(
re
s
Re
sponse
,
re
q
Re
quest
)
{}
cmdA
:=
&
Command
{
Options
:
[]
Option
{
...
...
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