提交 b7b15b8b 作者: Matt Bell 提交者: Juan Batiz-Benet

cmd/ipfs2: Added isLocal function for testing if a command is local only

上级 2dd6f241
......@@ -21,6 +21,7 @@ var localCommands = map[string]*cmds.Command{
"tour": cmdTour,
"commands": commands.CommandsCmd(Root),
}
var localMap = make(map[*cmds.Command]bool)
func init() {
// setting here instead of in literal to prevent initialization loop
......@@ -33,4 +34,14 @@ func init() {
Root.Subcommands[k] = v
}
}
for _, v := range localCommands {
localMap[v] = true
}
}
// isLocal returns true if the command should only be run locally (not sent to daemon), otherwise false
func isLocal(cmd *cmds.Command) bool {
_, found := localMap[cmd]
return found
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论