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 <brian@perfmode.com>
Brian Tiger Chow committed
Nov 13, 2014 at 15:31 UTC
c99e9e6000f2b73db8ea24f7f28ce46fbe1d669b
2 files changed
+5
-1
cmd/ipfs2/ipfs.go
+4
@@ -55,6 +55,10 @@ type cmdDetails struct {
55
doesNotUseRepo bool
56
}
57
58
+func (d *cmdDetails) canRunOnClient() bool { return !d.cannotRunOnClient }
59
+func (d *cmdDetails) canRunOnDaemon() bool { return !d.cannotRunOnDaemon }
60
+func (d *cmdDetails) usesRepo() bool { return !d.doesNotUseRepo }
61
+
62
// "What is this madness!?" you ask. Our commands have the unfortunate problem of
63
// not being able to run on all the same contexts. This map describes these
64
// properties so that other code can make decisions about whether to invoke a
cmd/ipfs2/main.go
+1
-1
@@ -281,7 +281,7 @@ func commandShouldRunOnDaemon(req cmds.Request, root *cmds.Command) (bool, error
281
return false, fmt.Errorf("command disabled: %s", path[0])
282
}
283
284
- if details.doesNotUseRepo && !details.cannotRunOnClient {
284
+ if details.doesNotUseRepo && details.canRunOnClient() {
285
return false, nil
286
}
287