From 0eeed7cc68caafc8cede3168e7c10fd20b73c315 Mon Sep 17 00:00:00 2001 From: Brian Tiger Chow Date: Thu, 13 Nov 2014 22:47:58 -0800 Subject: [PATCH] add string method to command details License: MIT Signed-off-by: Brian Tiger Chow --- cmd/ipfs2/ipfs.go | 7 +++++++ cmd/ipfs2/main.go | 1 + 2 files changed, 8 insertions(+) diff --git a/cmd/ipfs2/ipfs.go b/cmd/ipfs2/ipfs.go index 402ce55a7..d6f256d54 100644 --- a/cmd/ipfs2/ipfs.go +++ b/cmd/ipfs2/ipfs.go @@ -1,6 +1,8 @@ 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 } diff --git a/cmd/ipfs2/main.go b/cmd/ipfs2/main.go index f394ec980..0742bf47c 100644 --- a/cmd/ipfs2/main.go +++ b/cmd/ipfs2/main.go @@ -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])