提交 24814a41 作者: Matt Bell 提交者: Juan Batiz-Benet

core/commands2: Set root subcommands in init to prevent initialization loops

上级 6ae09b16
...@@ -50,10 +50,14 @@ Plumbing commands: ...@@ -50,10 +50,14 @@ Plumbing commands:
Use "ipfs help <command>" for more information about a command. Use "ipfs help <command>" for more information about a command.
`, `,
Subcommands: map[string]*cmds.Command{ }
var rootSubcommands = map[string]*cmds.Command{
"cat": catCmd, "cat": catCmd,
"ls": lsCmd, "ls": lsCmd,
"commands": commandsCmd,
"init": initCmd, "init": initCmd,
"daemon": daemonCmd,
// test subcommands // test subcommands
// TODO: remove these when we don't need them anymore // TODO: remove these when we don't need them anymore
...@@ -105,10 +109,8 @@ Use "ipfs help <command>" for more information about a command. ...@@ -105,10 +109,8 @@ Use "ipfs help <command>" for more information about a command.
res.SetValue(req.Stream()) res.SetValue(req.Stream())
}, },
}, },
},
} }
func init() { func init() {
Root.Subcommands["daemon"] = daemonCmd Root.Subcommands = rootSubcommands
Root.Subcommands["commands"] = commandsCmd
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论