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
0eeed7cc
Commit
0eeed7cc
authored
Nov 13, 2014
by
Brian Tiger Chow
Committed by
Juan Batiz-Benet
Nov 14, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add string method to command details
License: MIT Signed-off-by:
Brian Tiger Chow
<
brian@perfmode.com
>
parent
1348af01
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
0 deletions
+8
-0
cmd/ipfs2/ipfs.go
cmd/ipfs2/ipfs.go
+7
-0
cmd/ipfs2/main.go
cmd/ipfs2/main.go
+1
-0
No files found.
cmd/ipfs2/ipfs.go
View file @
0eeed7cc
package
main
import
(
"fmt"
cmds
"github.com/jbenet/go-ipfs/commands"
commands
"github.com/jbenet/go-ipfs/core/commands2"
)
...
...
@@ -55,6 +57,11 @@ type cmdDetails struct {
doesNotUseRepo
bool
}
func
(
d
*
cmdDetails
)
String
()
string
{
return
fmt
.
Sprintf
(
"on client? %t, on daemon? %t, uses repo? %t"
,
d
.
canRunOnClient
(),
d
.
canRunOnDaemon
(),
d
.
usesRepo
())
}
func
(
d
*
cmdDetails
)
canRunOnClient
()
bool
{
return
!
d
.
cannotRunOnClient
}
func
(
d
*
cmdDetails
)
canRunOnDaemon
()
bool
{
return
!
d
.
cannotRunOnDaemon
}
func
(
d
*
cmdDetails
)
usesRepo
()
bool
{
return
!
d
.
doesNotUseRepo
}
...
...
cmd/ipfs2/main.go
View file @
0eeed7cc
...
...
@@ -276,6 +276,7 @@ func commandShouldRunOnDaemon(req cmds.Request, root *cmds.Command) (bool, error
if
!
found
{
details
=
cmdDetails
{}
// defaults
}
log
.
Debugf
(
"cmd perms for +%v: %s"
,
path
,
details
.
String
())
if
details
.
cannotRunOnClient
&&
details
.
cannotRunOnDaemon
{
return
false
,
fmt
.
Errorf
(
"command disabled: %s"
,
path
[
0
])
...
...
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