mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-24 22:38:27 +08:00
cmd/ipfs2: Copy subcommands from core/commands2 root into cmd/ipfs2 root
This commit is contained in:

committed by
Juan Batiz-Benet

parent
53e875e5fc
commit
fd8b1930af
@ -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)
|
||||
|
Reference in New Issue
Block a user