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-dms3
Commits
3d0ca14b
Commit
3d0ca14b
authored
Oct 22, 2014
by
Matt Bell
Committed by
Juan Batiz-Benet
Nov 14, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core/commands: Added more advanced test subcommand
parent
3ae6117c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
core/commands/root.go
core/commands/root.go
+20
-0
No files found.
core/commands/root.go
View file @
3d0ca14b
package
commands
package
commands
import
(
import
(
"fmt"
cmds
"github.com/jbenet/go-ipfs/commands"
cmds
"github.com/jbenet/go-ipfs/commands"
"strings"
"strings"
)
)
...
@@ -52,5 +53,24 @@ Use "ipfs help <command>" for more information about a command.
...
@@ -52,5 +53,24 @@ Use "ipfs help <command>" for more information about a command.
res
.
SetValue
(
v
)
res
.
SetValue
(
v
)
},
},
},
},
"warp"
:
&
cmds
.
Command
{
Options
:
[]
cmds
.
Option
{
cmds
.
Option
{[]
string
{
"power"
,
"p"
},
cmds
.
Float
},
},
Run
:
func
(
req
cmds
.
Request
,
res
cmds
.
Response
)
{
threshold
:=
1.21
if
power
,
found
:=
req
.
Option
(
"power"
);
found
&&
power
.
(
float64
)
>=
threshold
{
res
.
SetValue
(
struct
{
Status
string
Power
float64
}{
"Flux capacitor activated!"
,
power
.
(
float64
)})
}
else
{
err
:=
fmt
.
Errorf
(
"Insufficient power (%v jiggawatts required)"
,
threshold
)
res
.
SetError
(
err
,
cmds
.
ErrClient
)
}
},
},
},
},
}
}
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