Commit d872e0cc authored by Jeromy's avatar Jeromy

move publish and resolve under the 'name' subcommand

parent 80c64ffa
......@@ -32,7 +32,7 @@ func makeCommand(cmdDesc command) commanderFunc {
u.POut(c.Long)
return nil
}
confdir, err := getConfigDir(c.Parent)
confdir, err := getConfigDir(c)
if err != nil {
return err
}
......
......@@ -56,8 +56,7 @@ Use "ipfs help <command>" for more information about a command.
cmdIpfsInit,
cmdIpfsServe,
cmdIpfsRun,
cmdIpfsPub,
cmdIpfsResolve,
cmdIpfsName,
},
Flag: *flag.NewFlagSet("ipfs", flag.ExitOnError),
}
......@@ -124,7 +123,11 @@ func localNode(confdir string, online bool) (*core.IpfsNode, error) {
// Gets the config "-c" flag from the command, or returns
// the default configuration root directory
func getConfigDir(c *commander.Command) (string, error) {
conf := c.Flag.Lookup("c").Value.Get()
root := c
for root.Parent != nil {
root = root.Parent
}
conf := root.Flag.Lookup("c").Value.Get()
if conf == nil {
return config.PathRoot()
}
......
package main
import (
"fmt"
flag "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/gonuts/flag"
commander "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/commander"
)
var cmdIpfsName = &commander.Command{
UsageLine: "name",
Short: "Ipfs namespace manipulation tools.",
Long: `ipfs name [publish|resolve] <ref/hash>`,
Run: addCmd,
Flag: *flag.NewFlagSet("ipfs-name", flag.ExitOnError),
Subcommands: []*commander.Command{
cmdIpfsPub,
cmdIpfsResolve,
},
}
func nameCmd(c *commander.Command, args []string) error {
fmt.Println(c.Long)
return nil
}
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