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

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

var Root = &cmds.Command{
	Options: commands.Root.Options,
	Help:    commands.Root.Help,
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
}

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