github.com/zignig/go-ipfs@v0.0.0-20141111235910-c9e5fdf55a52/cmd/ipfs/block.go (about)

     1  package main
     2  
     3  import (
     4  	flag "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/gonuts/flag"
     5  	commander "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/commander"
     6  	"github.com/jbenet/go-ipfs/core/commands"
     7  )
     8  
     9  var cmdIpfsBlock = &commander.Command{
    10  	UsageLine: "block",
    11  	Short:     "manipulate raw ipfs blocks",
    12  	Long: `ipfs block - manipulate raw ipfs blocks
    13  
    14      ipfs block get <key>  - get and output block named by <key>
    15      ipfs block put        - store stdin as a block, outputs <key>
    16  
    17  ipfs block is a plumbing command used to manipulate raw ipfs blocks.
    18  Reads from stdin or writes to stdout, and <key> is a base58 encoded
    19  multihash.`,
    20  	// Run: blockGetCmd,
    21  	Subcommands: []*commander.Command{
    22  		cmdIpfsBlockGet,
    23  		cmdIpfsBlockPut,
    24  	},
    25  	Flag: *flag.NewFlagSet("ipfs-block", flag.ExitOnError),
    26  }
    27  
    28  var cmdIpfsBlockGet = &commander.Command{
    29  	UsageLine: "get <key>",
    30  	Short:     "get and output block named by <key>",
    31  	Long: `ipfs get <key> - get and output block named by <key>
    32  
    33  ipfs block get is a plumbing command for retreiving raw ipfs blocks.
    34  It outputs to stdout, and <key> is a base58 encoded multihash.`,
    35  	Run: makeCommand(command{
    36  		name:   "blockGet",
    37  		args:   1,
    38  		flags:  nil,
    39  		online: true,
    40  		cmdFn:  commands.BlockGet,
    41  	}),
    42  }
    43  
    44  var cmdIpfsBlockPut = &commander.Command{
    45  	UsageLine: "put",
    46  	Short:     "store stdin as a block, outputs <key>",
    47  	Long: `ipfs put - store stdin as a block, outputs <key>
    48  
    49  ipfs block put is a plumbing command for storing raw ipfs blocks.
    50  It reads from stding, and <key> is a base58 encoded multihash.`,
    51  	Run: makeCommand(command{
    52  		name:   "blockPut",
    53  		args:   0,
    54  		flags:  nil,
    55  		online: true,
    56  		cmdFn:  commands.BlockPut,
    57  	}),
    58  }