mirror of
https://github.com/ipfs/kubo.git
synced 2025-08-05 19:02:21 +08:00
core/commands: Ported commands to use HelpText struct for helptext fields
This commit is contained in:

committed by
Juan Batiz-Benet

parent
9afb85714a
commit
7f24a9965f
@ -29,18 +29,22 @@ type AddOutput struct {
|
||||
}
|
||||
|
||||
var addCmd = &cmds.Command{
|
||||
Helptext: cmds.HelpText{
|
||||
Tagline: "Add an object to ipfs.",
|
||||
ShortDescription: `
|
||||
Adds contents of <path> to ipfs. Use -r to add directories.
|
||||
Note that directories are added recursively, to form the ipfs
|
||||
MerkleDAG. A smarter partial add with a staging area (like git)
|
||||
remains to be implemented.
|
||||
`,
|
||||
},
|
||||
|
||||
Options: []cmds.Option{
|
||||
cmds.BoolOption("recursive", "r", "Must be specified when adding directories"),
|
||||
},
|
||||
Arguments: []cmds.Argument{
|
||||
cmds.StringArg("file", true, true, "The path to a file to be added to IPFS"),
|
||||
},
|
||||
Description: "Add an object to ipfs.",
|
||||
Help: `Adds contents of <path> to ipfs. Use -r to add directories.
|
||||
Note that directories are added recursively, to form the ipfs
|
||||
MerkleDAG. A smarter partial add with a staging area (like git)
|
||||
remains to be implemented.
|
||||
`,
|
||||
Run: func(req cmds.Request) (interface{}, error) {
|
||||
added := &AddOutput{}
|
||||
n, err := req.Context().GetNode()
|
||||
|
@ -21,10 +21,15 @@ type Block struct {
|
||||
}
|
||||
|
||||
var blockCmd = &cmds.Command{
|
||||
Description: "Manipulate raw IPFS blocks",
|
||||
Help: `'ipfs block' is a plumbing command used to manipulate raw ipfs blocks.
|
||||
Helptext: cmds.HelpText{
|
||||
Tagline: "Manipulate raw IPFS blocks",
|
||||
ShortDescription: `
|
||||
'ipfs block' is a plumbing command used to manipulate raw ipfs blocks.
|
||||
Reads from stdin or writes to stdout, and <key> is a base58 encoded
|
||||
multihash.`,
|
||||
multihash.
|
||||
`,
|
||||
},
|
||||
|
||||
Subcommands: map[string]*cmds.Command{
|
||||
"get": blockGetCmd,
|
||||
"put": blockPutCmd,
|
||||
@ -32,9 +37,13 @@ multihash.`,
|
||||
}
|
||||
|
||||
var blockGetCmd = &cmds.Command{
|
||||
Description: "Get a raw IPFS block",
|
||||
Help: `ipfs block get is a plumbing command for retreiving raw ipfs blocks.
|
||||
It outputs to stdout, and <key> is a base58 encoded multihash.`,
|
||||
Helptext: cmds.HelpText{
|
||||
Tagline: "Get a raw IPFS block",
|
||||
ShortDescription: `
|
||||
'ipfs block get' is a plumbing command for retreiving raw ipfs blocks.
|
||||
It outputs to stdout, and <key> is a base58 encoded multihash.
|
||||
`,
|
||||
},
|
||||
|
||||
Arguments: []cmds.Argument{
|
||||
cmds.StringArg("key", true, false, "The base58 multihash of an existing block to get"),
|
||||
|
@ -19,9 +19,11 @@ type BootstrapOutput struct {
|
||||
var peerOptionDesc = "A peer to add to the bootstrap list (in the format '<multiaddr>/<peerID>')"
|
||||
|
||||
var bootstrapCmd = &cmds.Command{
|
||||
Description: "Show or edit the list of bootstrap peers",
|
||||
Help: `Running 'ipfs bootstrap' with no arguments will run 'ipfs bootstrap list'.
|
||||
Helptext: cmds.HelpText{
|
||||
Tagline: "Show or edit the list of bootstrap peers",
|
||||
ShortDescription: `Running 'ipfs bootstrap' with no arguments will run 'ipfs bootstrap list'.
|
||||
` + bootstrapSecurityWarning,
|
||||
},
|
||||
|
||||
Run: bootstrapListCmd.Run,
|
||||
Marshallers: bootstrapListCmd.Marshallers,
|
||||
@ -35,10 +37,12 @@ var bootstrapCmd = &cmds.Command{
|
||||
}
|
||||
|
||||
var bootstrapAddCmd = &cmds.Command{
|
||||
Description: "Add peers to the bootstrap list",
|
||||
Help: `Outputs a list of peers that were added (that weren't already
|
||||
Helptext: cmds.HelpText{
|
||||
Tagline: "Add peers to the bootstrap list",
|
||||
ShortDescription: `Outputs a list of peers that were added (that weren't already
|
||||
in the bootstrap list).
|
||||
` + bootstrapSecurityWarning,
|
||||
},
|
||||
|
||||
Arguments: []cmds.Argument{
|
||||
cmds.StringArg("peer", true, true, peerOptionDesc),
|
||||
@ -81,9 +85,11 @@ in the bootstrap list).
|
||||
}
|
||||
|
||||
var bootstrapRemoveCmd = &cmds.Command{
|
||||
Description: "Removes peers from the bootstrap list",
|
||||
Help: `Outputs the list of peers that were removed.
|
||||
Helptext: cmds.HelpText{
|
||||
Tagline: "Removes peers from the bootstrap list",
|
||||
ShortDescription: `Outputs the list of peers that were removed.
|
||||
` + bootstrapSecurityWarning,
|
||||
},
|
||||
|
||||
Arguments: []cmds.Argument{
|
||||
cmds.StringArg("peer", true, true, peerOptionDesc),
|
||||
@ -126,9 +132,10 @@ var bootstrapRemoveCmd = &cmds.Command{
|
||||
}
|
||||
|
||||
var bootstrapListCmd = &cmds.Command{
|
||||
Description: "Show peers in the bootstrap list",
|
||||
Help: `Peers are output in the format '<multiaddr>/<peerID>'.
|
||||
`,
|
||||
Helptext: cmds.HelpText{
|
||||
Tagline: "Show peers in the bootstrap list",
|
||||
ShortDescription: "Peers are output in the format '<multiaddr>/<peerID>'.",
|
||||
},
|
||||
|
||||
Run: func(req cmds.Request) (interface{}, error) {
|
||||
cfg, err := req.Context().GetConfig()
|
||||
|
@ -10,10 +10,13 @@ import (
|
||||
)
|
||||
|
||||
var catCmd = &cmds.Command{
|
||||
Description: "Show IPFS object data",
|
||||
Help: `Retrieves the object named by <ipfs-path> and outputs the data
|
||||
Helptext: cmds.HelpText{
|
||||
Tagline: "Show IPFS object data",
|
||||
ShortDescription: `
|
||||
Retrieves the object named by <ipfs-path> and outputs the data
|
||||
it contains.
|
||||
`,
|
||||
`,
|
||||
},
|
||||
|
||||
Arguments: []cmds.Argument{
|
||||
cmds.StringArg("ipfs-path", true, true, "The path to the IPFS object(s) to be outputted"),
|
||||
|
@ -37,11 +37,14 @@ var diagCmd = &cmds.Command{
|
||||
}
|
||||
|
||||
var diagNetCmd = &cmds.Command{
|
||||
Description: "Generates a network diagnostics report",
|
||||
Help: `Sends out a message to each node in the network recursively
|
||||
Helptext: cmds.HelpText{
|
||||
Tagline: "Generates a network diagnostics report",
|
||||
ShortDescription: `
|
||||
Sends out a message to each node in the network recursively
|
||||
requesting a listing of data about them including number of
|
||||
connected peers and latencies between them.
|
||||
`,
|
||||
},
|
||||
|
||||
Run: func(req cmds.Request) (interface{}, error) {
|
||||
n, err := req.Context().GetNode()
|
||||
|
@ -8,10 +8,13 @@ import (
|
||||
)
|
||||
|
||||
var logCmd = &cmds.Command{
|
||||
Description: "Change the logging level",
|
||||
Help: `'ipfs log' is a utility command used to change the logging
|
||||
Helptext: cmds.HelpText{
|
||||
Tagline: "Change the logging level",
|
||||
ShortDescription: `
|
||||
'ipfs log' is a utility command used to change the logging
|
||||
output of a running daemon.
|
||||
`,
|
||||
},
|
||||
|
||||
Arguments: []cmds.Argument{
|
||||
cmds.StringArg("subsystem", true, false, "the subsystem logging identifier. Use * for all subsystems."),
|
||||
|
@ -23,12 +23,15 @@ type LsOutput struct {
|
||||
}
|
||||
|
||||
var lsCmd = &cmds.Command{
|
||||
Description: "List links from an object.",
|
||||
Help: `Retrieves the object named by <ipfs-path> and displays the links
|
||||
Helptext: cmds.HelpText{
|
||||
Tagline: "List links from an object.",
|
||||
ShortDescription: `
|
||||
Retrieves the object named by <ipfs-path> and displays the links
|
||||
it contains, with the following format:
|
||||
|
||||
<link base58 hash> <link size in bytes> <link name>
|
||||
`,
|
||||
},
|
||||
|
||||
Arguments: []cmds.Argument{
|
||||
cmds.StringArg("ipfs-path", false, true, "The path to the IPFS object(s) to list links from"),
|
||||
|
@ -18,11 +18,14 @@ import (
|
||||
const mountTimeout = time.Second
|
||||
|
||||
var mountCmd = &cmds.Command{
|
||||
Description: "Mounts IPFS to the filesystem (read-only)",
|
||||
Help: `Mount ipfs at a read-only mountpoint on the OS. All ipfs objects
|
||||
Helptext: cmds.HelpText{
|
||||
Tagline: "Mounts IPFS to the filesystem (read-only)",
|
||||
ShortDescription: `
|
||||
Mount ipfs at a read-only mountpoint on the OS. All ipfs objects
|
||||
will be accessible under that directory. Note that the root will
|
||||
not be listable, as it is virtual. Accessing known paths directly.
|
||||
`,
|
||||
},
|
||||
|
||||
Options: []cmds.Option{
|
||||
// TODO longform
|
||||
|
@ -7,8 +7,10 @@ import (
|
||||
)
|
||||
|
||||
var ipfsMount = &cmds.Command{
|
||||
Description: "Not yet implemented on Windows",
|
||||
Help: `Not yet implemented on Windows. :(`,
|
||||
Helptext: cmds.HelpText{
|
||||
Tagline: "Not yet implemented on Windows",
|
||||
ShortDescription: "Not yet implemented on Windows. :(",
|
||||
},
|
||||
|
||||
Run: func(req cmds.Request) (interface{}, error) {
|
||||
return errors.New("Mount isn't compatible with Windows yet"), nil
|
||||
|
Reference in New Issue
Block a user