cat.go 1.03 KB
Newer Older
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
1 2 3
package main

import (
4 5
	"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/gonuts/flag"
	"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/commander"
6
	"github.com/jbenet/go-ipfs/core/commands"
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
7 8 9 10 11 12 13 14 15 16 17 18 19 20
)

var cmdIpfsCat = &commander.Command{
	UsageLine: "cat",
	Short:     "Show ipfs object data.",
	Long: `ipfs cat <ipfs-path> - Show ipfs object data.

    Retrieves the object named by <ipfs-path> and displays the Data
    it contains.
`,
	Run:  catCmd,
	Flag: *flag.NewFlagSet("ipfs-cat", flag.ExitOnError),
}

21 22 23
var catCmd = MakeCommand("cat", nil, commands.Cat)

/*
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
24 25 26 27 28 29
func catCmd(c *commander.Command, inp []string) error {
	if len(inp) < 1 {
		u.POut(c.Long)
		return nil
	}

30 31
	com := daemon.NewCommand()
	com.Command = "cat"
32
	com.Args = inp
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
33

34
	err := daemon.SendCommand(com, "localhost:12345")
35
	if err != nil {
36 37 38 39
		conf, err := getConfigDir(c.Parent)
		if err != nil {
			return err
		}
Jeromy's avatar
Jeromy committed
40
		n, err := localNode(conf, false)
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
41 42 43 44
		if err != nil {
			return err
		}

45
		return commands.Cat(n, com.Args, com.Opts, os.Stdout)
46 47 48
	}
	return nil
}
49
*/