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

     1  package main
     2  
     3  import (
     4  	"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/gonuts/flag"
     5  	"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/commander"
     6  	commands "github.com/jbenet/go-ipfs/core/commands"
     7  )
     8  
     9  var cmdIpfsRefs = &commander.Command{
    10  	UsageLine: "refs",
    11  	Short:     "List link hashes from an object.",
    12  	Long: `ipfs refs <ipfs-path> - List link hashes from an object..
    13  
    14      Retrieves the object named by <ipfs-path> and displays the link
    15      hashes it contains, with the following format:
    16  
    17      <link base58 hash>
    18  
    19      Note: list all refs recursively with -r.
    20  
    21  `,
    22  	Run:  refCmd,
    23  	Flag: *flag.NewFlagSet("ipfs-refs", flag.ExitOnError),
    24  }
    25  
    26  func init() {
    27  	cmdIpfsRefs.Flag.Bool("r", false, "recursive: list refs recursively")
    28  	cmdIpfsRefs.Flag.Bool("u", false, "unique: list each ref only once")
    29  }
    30  
    31  var refCmd = makeCommand(command{
    32  	name:  "refs",
    33  	args:  1,
    34  	flags: []string{"r", "u"},
    35  	cmdFn: commands.Refs,
    36  })