Skip to content

Commit 7d02274

Browse files
Merge pull request #3806 from ipfs/lgierth-patch-1
commands: improve name and key helptexts
2 parents 646dbde + 0e68ffa commit 7d02274

File tree

5 files changed

+54
-30
lines changed

5 files changed

+54
-30
lines changed

core/commands/ipns.go

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,24 @@ import (
1313

1414
var IpnsCmd = &cmds.Command{
1515
Helptext: cmds.HelpText{
16-
Tagline: "Get the value currently published at an IPNS name.",
16+
Tagline: "Resolve IPNS names.",
1717
ShortDescription: `
1818
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.
2122
`,
2223
LongDescription: `
2324
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.
2628
29+
You can use the 'ipfs key' commands to list and generate more names and their respective keys.
2730
2831
Examples:
2932
30-
Resolve the value of your identity:
33+
Resolve the value of your name:
3134
3235
> ipfs name resolve
3336
/ipfs/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy
@@ -37,7 +40,7 @@ Resolve the value of another name:
3740
> ipfs name resolve QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ
3841
/ipfs/QmSiTko9JZyabH56y2fussEt1A5oDqsFXB3CkvAqraFryz
3942
40-
Resolve the value of a reference:
43+
Resolve the value of a dnslink:
4144
4245
> ipfs name resolve ipfs.io
4346
/ipfs/QmaBvfZooxWkrv7D3r8LS9moNjzD2o525XMZze69hhoxf5
@@ -91,7 +94,7 @@ Resolve the value of a reference:
9194
var name string
9295
if len(req.Arguments()) == 0 {
9396
if n.Identity == "" {
94-
res.SetError(errors.New("Identity not loaded!"), cmds.ErrNormal)
97+
res.SetError(errors.New("identity not loaded"), cmds.ErrNormal)
9598
return
9699
}
97100
name = n.Identity.Pretty()

core/commands/keystore.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,19 @@ import (
1818

1919
var KeyCmd = &cmds.Command{
2020
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+
`,
2234
},
2335
Subcommands: map[string]*cmds.Command{
2436
"gen": KeyGenCmd,

core/commands/name.go

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,35 @@ type IpnsEntry struct {
99

1010
var NameCmd = &cmds.Command{
1111
Helptext: cmds.HelpText{
12-
Tagline: "Interact with the IPFS namespace (IPNS).",
12+
Tagline: "Publish and resolve IPNS names.",
1313
ShortDescription: `
1414
IPNS is a PKI namespace, where names are the hashes of public keys, and
1515
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.
1718
`,
1819
LongDescription: `
1920
IPNS is a PKI namespace, where names are the hashes of public keys, and
2021
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.
2224
25+
You can use the 'ipfs key' commands to list and generate more names and their respective keys.
2326
2427
Examples:
2528
26-
Publish an <ipfs-path> to your identity name:
29+
Publish an <ipfs-path> with your default name:
2730
2831
> ipfs name publish /ipfs/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy
2932
Published to QmbCMUZw6JFeZ7Wp9jkzbye3Fzp2GGcPgC3nmeUjfVF87n: /ipfs/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy
3033
31-
Publish an <ipfs-path> to another public key:
34+
Publish an <ipfs-path> with another name, added by an 'ipfs key' command:
3235
33-
> ipfs name publish /ipfs/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy QmbCMUZw6JFeZ7Wp9jkzbye3Fzp2GGcPgC3nmeUjfVF87n
36+
> ipfs key gen --type=rsa --size=2048 mykey
37+
> ipfs name publish --key=mykey /ipfs/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy
3438
Published to QmbCMUZw6JFeZ7Wp9jkzbye3Fzp2GGcPgC3nmeUjfVF87n: /ipfs/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy
3539
36-
Resolve the value of your identity:
40+
Resolve the value of your name:
3741
3842
> ipfs name resolve
3943
/ipfs/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy
@@ -43,7 +47,7 @@ Resolve the value of another name:
4347
> ipfs name resolve QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ
4448
/ipfs/QmSiTko9JZyabH56y2fussEt1A5oDqsFXB3CkvAqraFryz
4549
46-
Resolve the value of a reference:
50+
Resolve the value of a dnslink:
4751
4852
> ipfs name resolve ipfs.io
4953
/ipfs/QmaBvfZooxWkrv7D3r8LS9moNjzD2o525XMZze69hhoxf5

core/commands/publish.go

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,32 @@ var errNotOnline = errors.New("This command must be run in online mode. Try runn
2020

2121
var PublishCmd = &cmds.Command{
2222
Helptext: cmds.HelpText{
23-
Tagline: "Publish an object to IPNS.",
23+
Tagline: "Publish IPNS names.",
2424
ShortDescription: `
2525
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.
2829
`,
2930
LongDescription: `
3031
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.
3337
3438
Examples:
3539
36-
Publish an <ipfs-path> to your identity name:
40+
Publish an <ipfs-path> with your default name:
3741
3842
> ipfs name publish /ipfs/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy
3943
Published to QmbCMUZw6JFeZ7Wp9jkzbye3Fzp2GGcPgC3nmeUjfVF87n: /ipfs/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy
4044
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:
4246
43-
> ipfs name publish /ipfs/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy QmbCMUZw6JFeZ7Wp9jkzbye3Fzp2GGcPgC3nmeUjfVF87n
47+
> ipfs key gen --type=rsa --size=2048 mykey
48+
> ipfs name publish --key=mykey /ipfs/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy
4449
Published to QmbCMUZw6JFeZ7Wp9jkzbye3Fzp2GGcPgC3nmeUjfVF87n: /ipfs/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy
4550
4651
`,
@@ -56,7 +61,7 @@ Publish an <ipfs-path> to another public key (not implemented):
5661
This accepts durations such as "300s", "1.5h" or "2h45m". Valid time units are
5762
"ns", "us" (or "µs"), "ms", "s", "m", "h".`).Default("24h"),
5863
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"),
6065
},
6166
Run: func(req cmds.Request, res cmds.Response) {
6267
log.Debug("begin publish")
@@ -75,14 +80,14 @@ Publish an <ipfs-path> to another public key (not implemented):
7580
}
7681

7782
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)
7984
return
8085
}
8186

8287
pstr := req.Arguments()[0]
8388

8489
if n.Identity == "" {
85-
res.SetError(errors.New("Identity not loaded!"), cmds.ErrNormal)
90+
res.SetError(errors.New("identity not loaded"), cmds.ErrNormal)
8691
return
8792
}
8893

core/commands/root.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ ADVANCED COMMANDS
4141
daemon Start a long-running daemon process
4242
mount Mount an IPFS read-only mountpoint
4343
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
4546
dns Resolve DNS links
4647
pin Pin objects to local storage
4748
repo Manipulate the IPFS repository
4849
stats Various operational stats
49-
key Create and manipulate keypairs
5050
5151
NETWORK COMMANDS
5252
id Show info about IPFS peers

0 commit comments

Comments
 (0)