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

cmd/ipfs2: Added comments to explain purpose of CLI root

parent 1342575d
......@@ -5,12 +5,17 @@ import (
commands "github.com/jbenet/go-ipfs/core/commands2"
)
// This is the CLI root, used for executing commands accessible to CLI clients.
// Some subcommands (like 'ipfs daemon' or 'ipfs init') are only accessible here,
// and can't be called through the HTTP API.
var Root = &cmds.Command{
Options: commands.Root.Options,
Helptext: commands.Root.Helptext,
}
var rootSubcommands = map[string]*cmds.Command{
// Commands in localCommands should always be run locally (even if daemon is running).
// They can override subcommands in commands.Root by defining a subcommand with the same name.
var localCommands = map[string]*cmds.Command{
"daemon": daemonCmd, // TODO name
"init": initCmd, // TODO name
"tour": cmdTour,
......@@ -20,7 +25,7 @@ var rootSubcommands = map[string]*cmds.Command{
func init() {
// setting here instead of in literal to prevent initialization loop
// (some commands make references to Root)
Root.Subcommands = rootSubcommands
Root.Subcommands = localCommands
// copy all subcommands from commands.Root into this root (if they aren't already present)
for k, v := range commands.Root.Subcommands {
......
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