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

cmd/ipfs: Reverted back to secondary CLI root command

parent 24814a41
package commands
package main
import (
"fmt"
......@@ -10,11 +10,11 @@ import (
cmds "github.com/jbenet/go-ipfs/commands"
cmdsHttp "github.com/jbenet/go-ipfs/commands/http"
"github.com/jbenet/go-ipfs/core"
commands "github.com/jbenet/go-ipfs/core/commands2"
daemon "github.com/jbenet/go-ipfs/daemon2"
)
var daemonCmd = &cmds.Command{
Private: true,
Options: []cmds.Option{},
Help: "TODO",
Subcommands: map[string]*cmds.Command{},
......@@ -50,7 +50,7 @@ func daemonFunc(res cmds.Response, req cmds.Request) {
return
}
handler := cmdsHttp.Handler{*ctx, Root}
handler := cmdsHttp.Handler{*ctx, commands.Root}
http.Handle(cmdsHttp.ApiPath+"/", handler)
fmt.Printf("API server listening on '%s'\n", host)
......
package commands
package main
import (
"encoding/base64"
......@@ -15,7 +15,6 @@ import (
)
var initCmd = &cmds.Command{
Private: true,
Options: []cmds.Option{
cmds.Option{[]string{"bits", "b"}, cmds.Int},
cmds.Option{[]string{"passphrase", "p"}, cmds.String},
......
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,
Subcommands: map[string]*cmds.Command{
"daemon": daemonCmd,
"init": initCmd,
},
}
......@@ -22,13 +22,13 @@ var log = u.Logger("cmd/ipfs")
func main() {
args := os.Args[1:]
req, err := cmdsCli.Parse(args, commands.Root)
req, root, err := cmdsCli.Parse(args, Root, commands.Root)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
options, err := getOptions(req, commands.Root)
options, err := getOptions(req, root)
if err != nil {
fmt.Println(err)
os.Exit(1)
......@@ -80,8 +80,8 @@ func main() {
}
var res cmds.Response
if req.Command().Private {
res = commands.Root.Call(req)
if root == Root {
res = root.Call(req)
} else {
local, found := options.Option("local")
......@@ -101,7 +101,7 @@ func main() {
}
ctx.Node = node
res = commands.Root.Call(req)
res = root.Call(req)
}
}
......
......@@ -56,8 +56,6 @@ var rootSubcommands = map[string]*cmds.Command{
"cat": catCmd,
"ls": lsCmd,
"commands": commandsCmd,
"init": initCmd,
"daemon": daemonCmd,
// test subcommands
// TODO: remove these when we don't need them anymore
......
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