block.go 1.33 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
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
    ipfs block put <key>  < valfile   - pipe valfile to block <key>
Examples:

  Get the value of the 'datastore.path' key:

      ipfs config datastore.path

  Set the value of the 'datastore.path' key:

      ipfs config datastore.path ~/.go-ipfs/datastore

`,
	// Run: blockGetCmd,
	Subcommands: []*commander.Command{
		cmdIpfsBlockGet,
		cmdIpfsBlockPut,
	},
	Flag: *flag.NewFlagSet("ipfs-block", flag.ExitOnError),
}

var cmdIpfsBlockGet = &commander.Command{
	UsageLine: "get",
	Short:     "get a row ipfs block",
	Run: makeCommand(command{
39
		name:   "blockGet",
40 41 42 43 44 45 46 47 48 49 50
		args:   1,
		flags:  nil,
		online: true,
		cmdFn:  commands.BlockGet,
	}),
}

var cmdIpfsBlockPut = &commander.Command{
	UsageLine: "put",
	Short:     "put a row ipfs block",
	Run: makeCommand(command{
51
		name:   "blockPut",
52 53 54 55 56 57
		args:   1,
		flags:  nil,
		online: true,
		cmdFn:  commands.BlockPut,
	}),
}