block.go 1.16 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
package main

import (
	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"
	"github.com/jbenet/go-ipfs/core/commands"
)

var cmdIpfsBlock = &commander.Command{
	UsageLine: "block",
	Short:     "get/put **raw** ipfs blocks",
	Long: `ipfs block (get|put) - get/put **raw** ipfs blocks.

    ipfs block get <key> > valfile    - get block of <key> and write it to valfile
15
    ipfs block put < valfile          - saves the conents of valfile and returns it's <key>
16 17 18 19 20 21 22 23 24 25 26
`,
	// Run: blockGetCmd,
	Subcommands: []*commander.Command{
		cmdIpfsBlockGet,
		cmdIpfsBlockPut,
	},
	Flag: *flag.NewFlagSet("ipfs-block", flag.ExitOnError),
}

var cmdIpfsBlockGet = &commander.Command{
	UsageLine: "get",
27
	Short:     "get a raw ipfs block",
28
	Run: makeCommand(command{
29
		name:   "blockGet",
30 31 32 33 34 35 36 37 38
		args:   1,
		flags:  nil,
		online: true,
		cmdFn:  commands.BlockGet,
	}),
}

var cmdIpfsBlockPut = &commander.Command{
	UsageLine: "put",
39
	Short:     "put a raw ipfs block",
40
	Run: makeCommand(command{
41
		name:   "blockPut",
42
		args:   0,
43 44 45 46 47
		flags:  nil,
		online: true,
		cmdFn:  commands.BlockPut,
	}),
}