@cryptotaxi247 / kubo / commits / 0e68ffaaf

commands: improve name and key helptexts

License: MIT Signed-off-by: Lars Gierth <larsg@systemli.org>

Lars Gierth committed Mar 21, 2017 at 02:17 UTC 0e68ffaaf02290b6bd9181a310fd06587b2199d6
5 files changed +54 -30
core/commands/ipns.go
+11 -8
@@ -13,21 +13,24 @@ import (
13
14 var IpnsCmd = &cmds.Command{
15 Helptext: cmds.HelpText{
16 - Tagline: "Get the value currently published at an IPNS name.",
16 + Tagline: "Resolve IPNS names.",
17 ShortDescription: `
18 IPNS is a PKI namespace, where names are the hashes of public keys, and
19 -the private key enables publishing new (signed) values. In resolve, the
20 -default value of <name> is your own identity public key.
19 +the private key enables publishing new (signed) values. In both publish
20 +and resolve, the default name used is the node's own PeerID,
21 +which is the hash of its public key.
22 `,
23 LongDescription: `
24 IPNS is a PKI namespace, where names are the hashes of public keys, and
24 -the private key enables publishing new (signed) values. In resolve, the
25 -default value of <name> is your own identity public key.
25 +the private key enables publishing new (signed) values. In both publish
26 +and resolve, the default name used is the node's own PeerID,
27 +which is the hash of its public key.
28
29 +You can use the 'ipfs key' commands to list and generate more names and their respective keys.
30
31 Examples:
32
30 -Resolve the value of your identity:
33 +Resolve the value of your name:
34
35 > ipfs name resolve
36 /ipfs/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy
@@ -37,7 +40,7 @@ Resolve the value of another name:
40 > ipfs name resolve QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ
41 /ipfs/QmSiTko9JZyabH56y2fussEt1A5oDqsFXB3CkvAqraFryz
42
40 -Resolve the value of a reference:
43 +Resolve the value of a dnslink:
44
45 > ipfs name resolve ipfs.io
46 /ipfs/QmaBvfZooxWkrv7D3r8LS9moNjzD2o525XMZze69hhoxf5
@@ -91,7 +94,7 @@ Resolve the value of a reference:
94 var name string
95 if len(req.Arguments()) == 0 {
96 if n.Identity == "" {
94 - res.SetError(errors.New("Identity not loaded!"), cmds.ErrNormal)
97 + res.SetError(errors.New("identity not loaded"), cmds.ErrNormal)
98 return
99 }
100 name = n.Identity.Pretty()
core/commands/keystore.go
+13 -1
@@ -18,7 +18,19 @@ import (
18
19 var KeyCmd = &cmds.Command{
20 Helptext: cmds.HelpText{
21 - Tagline: "Create and manipulate keypairs",
21 + Tagline: "Create and list IPNS name keypairs",
22 + ShortDescription: `
23 +'ipfs key gen' generates a new keypair for usage with IPNS and 'ipfs name publish'.
24 +
25 + > ipfs key gen --type=rsa --size=2048 mykey
26 + > ipfs name publish --key=mykey QmSomeHash
27 +
28 +'ipfs key list' lists the available keys.
29 +
30 + > ipfs key list
31 + self
32 + mykey
33 + `,
34 },
35 Subcommands: map[string]*cmds.Command{
36 "gen": KeyGenCmd,
core/commands/name.go
+12 -8
@@ -9,31 +9,35 @@ type IpnsEntry struct {
9
10 var NameCmd = &cmds.Command{
11 Helptext: cmds.HelpText{
12 - Tagline: "Interact with the IPFS namespace (IPNS).",
12 + Tagline: "Publish and resolve IPNS names.",
13 ShortDescription: `
14 IPNS is a PKI namespace, where names are the hashes of public keys, and
15 the private key enables publishing new (signed) values. In both publish
16 -and resolve, the default value of <name> is your own identity public key.
16 +and resolve, the default name used is the node's own PeerID,
17 +which is the hash of its public key.
18 `,
19 LongDescription: `
20 IPNS is a PKI namespace, where names are the hashes of public keys, and
21 the private key enables publishing new (signed) values. In both publish
21 -and resolve, the default value of <name> is your own identity public key.
22 +and resolve, the default name used is the node's own PeerID,
23 +which is the hash of its public key.
24
25 +You can use the 'ipfs key' commands to list and generate more names and their respective keys.
26
27 Examples:
28
26 -Publish an <ipfs-path> to your identity name:
29 +Publish an <ipfs-path> with your default name:
30
31 > ipfs name publish /ipfs/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy
32 Published to QmbCMUZw6JFeZ7Wp9jkzbye3Fzp2GGcPgC3nmeUjfVF87n: /ipfs/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy
33
31 -Publish an <ipfs-path> to another public key:
34 +Publish an <ipfs-path> with another name, added by an 'ipfs key' command:
35
33 - > ipfs name publish /ipfs/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy QmbCMUZw6JFeZ7Wp9jkzbye3Fzp2GGcPgC3nmeUjfVF87n
36 + > ipfs key gen --type=rsa --size=2048 mykey
37 + > ipfs name publish --key=mykey /ipfs/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy
38 Published to QmbCMUZw6JFeZ7Wp9jkzbye3Fzp2GGcPgC3nmeUjfVF87n: /ipfs/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy
39
36 -Resolve the value of your identity:
40 +Resolve the value of your name:
41
42 > ipfs name resolve
43 /ipfs/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy
@@ -43,7 +47,7 @@ Resolve the value of another name:
47 > ipfs name resolve QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ
48 /ipfs/QmSiTko9JZyabH56y2fussEt1A5oDqsFXB3CkvAqraFryz
49
46 -Resolve the value of a reference:
50 +Resolve the value of a dnslink:
51
52 > ipfs name resolve ipfs.io
53 /ipfs/QmaBvfZooxWkrv7D3r8LS9moNjzD2o525XMZze69hhoxf5
core/commands/publish.go
+16 -11
@@ -20,27 +20,32 @@ var errNotOnline = errors.New("This command must be run in online mode. Try runn
20
21 var PublishCmd = &cmds.Command{
22 Helptext: cmds.HelpText{
23 - Tagline: "Publish an object to IPNS.",
23 + Tagline: "Publish IPNS names.",
24 ShortDescription: `
25 IPNS is a PKI namespace, where names are the hashes of public keys, and
26 -the private key enables publishing new (signed) values. In publish, the
27 -default value of <name> is your own identity public key.
26 +the private key enables publishing new (signed) values. In both publish
27 +and resolve, the default name used is the node's own PeerID,
28 +which is the hash of its public key.
29 `,
30 LongDescription: `
31 IPNS is a PKI namespace, where names are the hashes of public keys, and
31 -the private key enables publishing new (signed) values. In publish, the
32 -default value of <name> is your own identity public key.
32 +the private key enables publishing new (signed) values. In both publish
33 +and resolve, the default name used is the node's own PeerID,
34 +which is the hash of its public key.
35 +
36 +You can use the 'ipfs key' commands to list and generate more names and their respective keys.
37
38 Examples:
39
36 -Publish an <ipfs-path> to your identity name:
40 +Publish an <ipfs-path> with your default name:
41
42 > ipfs name publish /ipfs/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy
43 Published to QmbCMUZw6JFeZ7Wp9jkzbye3Fzp2GGcPgC3nmeUjfVF87n: /ipfs/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy
44
41 -Publish an <ipfs-path> to another public key (not implemented):
45 +Publish an <ipfs-path> with another name, added by an 'ipfs key' command:
46
43 - > ipfs name publish /ipfs/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy QmbCMUZw6JFeZ7Wp9jkzbye3Fzp2GGcPgC3nmeUjfVF87n
47 + > ipfs key gen --type=rsa --size=2048 mykey
48 + > ipfs name publish --key=mykey /ipfs/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy
49 Published to QmbCMUZw6JFeZ7Wp9jkzbye3Fzp2GGcPgC3nmeUjfVF87n: /ipfs/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy
50
51 `,
@@ -56,7 +61,7 @@ Publish an <ipfs-path> to another public key (not implemented):
61 This accepts durations such as "300s", "1.5h" or "2h45m". Valid time units are
62 "ns", "us" (or "µs"), "ms", "s", "m", "h".`).Default("24h"),
63 cmds.StringOption("ttl", "Time duration this record should be cached for (caution: experimental)."),
59 - cmds.StringOption("key", "k", "name of key to use").Default("self"),
64 + cmds.StringOption("key", "k", "Name of the key to be used, as listed by 'ipfs key list'. Default: <<default>>.").Default("self"),
65 },
66 Run: func(req cmds.Request, res cmds.Response) {
67 log.Debug("begin publish")
@@ -75,14 +80,14 @@ Publish an <ipfs-path> to another public key (not implemented):
80 }
81
82 if n.Mounts.Ipns != nil && n.Mounts.Ipns.IsActive() {
78 - res.SetError(errors.New("You cannot manually publish while IPNS is mounted."), cmds.ErrNormal)
83 + res.SetError(errors.New("cannot manually publish while IPNS is mounted"), cmds.ErrNormal)
84 return
85 }
86
87 pstr := req.Arguments()[0]
88
89 if n.Identity == "" {
85 - res.SetError(errors.New("Identity not loaded!"), cmds.ErrNormal)
90 + res.SetError(errors.New("identity not loaded"), cmds.ErrNormal)
91 return
92 }
93
core/commands/root.go
+2 -2
@@ -41,12 +41,12 @@ ADVANCED COMMANDS
41 daemon Start a long-running daemon process
42 mount Mount an IPFS read-only mountpoint
43 resolve Resolve any type of name
44 - name Publish or resolve IPNS names
44 + name Publish and resolve IPNS names
45 + key Create and list IPNS name keypairs
46 dns Resolve DNS links
47 pin Pin objects to local storage
48 repo Manipulate the IPFS repository
49 stats Various operational stats
49 - key Create and manipulate keypairs
50
51 NETWORK COMMANDS
52 id Show info about IPFS peers