Commit fd8b1930 authored by Matt Bell's avatar Matt Bell Committed by Juan Batiz-Benet

cmd/ipfs2: Copy subcommands from core/commands2 root into cmd/ipfs2 root

parent 53e875e5
......@@ -8,9 +8,23 @@ import (
var Root = &cmds.Command{
Options: commands.Root.Options,
Help: commands.Root.Help,
Subcommands: map[string]*cmds.Command{
"daemon": daemonCmd, // TODO name
"init": initCmd, // TODO name
"tour": cmdTour,
},
}
var rootSubcommands = map[string]*cmds.Command{
"daemon": daemonCmd, // TODO name
"init": initCmd, // TODO name
"tour": cmdTour,
}
func init() {
// setting here instead of in literal to prevent initialization loop
// (some commands make references to Root)
Root.Subcommands = rootSubcommands
// copy all subcommands from commands.Root into this root (if they aren't already present)
for k, v := range commands.Root.Subcommands {
if _, found := Root.Subcommands[k]; !found {
Root.Subcommands[k] = v
}
}
}
......@@ -94,7 +94,7 @@ func run() error {
}
func createRequest(args []string) (cmds.Request, *cmds.Command, error) {
req, root, cmd, path, err := cmdsCli.Parse(args, Root, commands.Root)
req, root, cmd, path, err := cmdsCli.Parse(args, Root)
// handle parse error (which means the commandline input was wrong,
// e.g. incorrect number of args, or nonexistent subcommand)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment