mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-01 10:49:24 +08:00
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>
This commit is contained in:

committed by
Juan Batiz-Benet

parent
5c4fa5a783
commit
c99e9e6000
@ -55,6 +55,10 @@ type cmdDetails struct {
|
|||||||
doesNotUseRepo bool
|
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
|
// "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
|
// 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
|
// properties so that other code can make decisions about whether to invoke a
|
||||||
|
@ -281,7 +281,7 @@ func commandShouldRunOnDaemon(req cmds.Request, root *cmds.Command) (bool, error
|
|||||||
return false, fmt.Errorf("command disabled: %s", path[0])
|
return false, fmt.Errorf("command disabled: %s", path[0])
|
||||||
}
|
}
|
||||||
|
|
||||||
if details.doesNotUseRepo && !details.cannotRunOnClient {
|
if details.doesNotUseRepo && details.canRunOnClient() {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user