ipfs.go 795 Bytes
Newer Older
1 2 3 4 5 6 7 8
package main

import (
	cmds "github.com/jbenet/go-ipfs/commands"
	commands "github.com/jbenet/go-ipfs/core/commands2"
)

var Root = &cmds.Command{
9 10
	Options:  commands.Root.Options,
	Helptext: commands.Root.Helptext,
11 12 13
}

var rootSubcommands = map[string]*cmds.Command{
14 15 16 17
	"daemon":   daemonCmd, // TODO name
	"init":     initCmd,   // TODO name
	"tour":     cmdTour,
	"commands": commands.CommandsCmd(Root),
18 19 20 21 22 23 24 25 26 27 28 29 30
}

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
		}
	}
31
}