pin.go 745 Bytes
Newer Older
1 2 3
package main

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

var cmdIpfsPin = &commander.Command{
	UsageLine: "pin",
	Short:     "pin an ipfs object to local storage.",
	Long: `ipfs pin <ipfs-path> - pin ipfs object to local storage.

    Retrieves the object named by <ipfs-path> and stores it locally
    on disk.
`,
	Run:  pinCmd,
	Flag: *flag.NewFlagSet("ipfs-pin", flag.ExitOnError),
}

21 22
func init() {
	cmdIpfsPin.Flag.Bool("r", false, "pin objects recursively")
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
23
	cmdIpfsPin.Flag.Int("d", 1, "recursive depth")
24
}
25

Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
26
var pinCmd = MakeCommand("pin", []string{"r", "d"}, commands.Pin)