From c99e9e6000f2b73db8ea24f7f28ce46fbe1d669b Mon Sep 17 00:00:00 2001 From: Brian Tiger Chow Date: Thu, 13 Nov 2014 15:31:15 -0800 Subject: [PATCH] feat(details) add funcs to negate negations not immediately useful, but nice to have tagging you to make sure i didn't make a mistake here @jbenet License: MIT Signed-off-by: Brian Tiger Chow --- cmd/ipfs2/ipfs.go | 4 ++++ cmd/ipfs2/main.go | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/ipfs2/ipfs.go b/cmd/ipfs2/ipfs.go index e12d60376..402ce55a7 100644 --- a/cmd/ipfs2/ipfs.go +++ b/cmd/ipfs2/ipfs.go @@ -55,6 +55,10 @@ type cmdDetails struct { doesNotUseRepo bool } +func (d *cmdDetails) canRunOnClient() bool { return !d.cannotRunOnClient } +func (d *cmdDetails) canRunOnDaemon() bool { return !d.cannotRunOnDaemon } +func (d *cmdDetails) usesRepo() bool { return !d.doesNotUseRepo } + // "What is this madness!?" you ask. Our commands have the unfortunate problem of // not being able to run on all the same contexts. This map describes these // properties so that other code can make decisions about whether to invoke a diff --git a/cmd/ipfs2/main.go b/cmd/ipfs2/main.go index 800fe6d3c..f394ec980 100644 --- a/cmd/ipfs2/main.go +++ b/cmd/ipfs2/main.go @@ -281,7 +281,7 @@ func commandShouldRunOnDaemon(req cmds.Request, root *cmds.Command) (bool, error return false, fmt.Errorf("command disabled: %s", path[0]) } - if details.doesNotUseRepo && !details.cannotRunOnClient { + if details.doesNotUseRepo && details.canRunOnClient() { return false, nil }