publish.go 1.27 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
package main

import (
	"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"
)

var cmdIpfsPub = &commander.Command{
	UsageLine: "publish",
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
	Short:     "publish a <ref> to ipns.",
	Long: `ipfs publish [<name>] <ref> - publish a <ref> to ipns.

IPNS is a PKI namespace, where names are the hashes of public keys, and
the private key enables publishing new (signed) values. In publish, the
default value of <name> is your own identity public key.

Examples:

Publish a <ref> to your identity name:

  > ipfs name publish QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy
  published name QmbCMUZw6JFeZ7Wp9jkzbye3Fzp2GGcPgC3nmeUjfVF87n to QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy

Publish a <ref> to another public key:

  > ipfs name publish QmbCMUZw6JFeZ7Wp9jkzbye3Fzp2GGcPgC3nmeUjfVF87n QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy
  published name QmbCMUZw6JFeZ7Wp9jkzbye3Fzp2GGcPgC3nmeUjfVF87n to QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy
29 30 31 32 33 34

`,
	Run:  pubCmd,
	Flag: *flag.NewFlagSet("ipfs-publish", flag.ExitOnError),
}

35 36 37
var pubCmd = makeCommand(command{
	name:   "publish",
	args:   1,
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
38
	flags:  nil,
39 40 41
	online: true,
	cmdFn:  commands.Publish,
})