Commit 2dd6f241 authored by Matt Bell's avatar Matt Bell Committed by Juan Batiz-Benet

core/commands2: Refactored some commands to HelpText struct for helptext fields

parent 2fd8f39c
......@@ -13,13 +13,16 @@ import (
)
var cmdTour = &cmds.Command{
Description: "An introduction to IPFS",
Help: `This is a tour that takes you through various IPFS concepts,
Helptext: cmds.HelpText{
Tagline: "An introduction to IPFS",
ShortDescription: `
This is a tour that takes you through various IPFS concepts,
features, and tools to make sure you get up to speed with
IPFS very quickly. To start, run:
ipfs tour
`,
},
Arguments: []cmds.Argument{
cmds.StringArg("number", false, false, "The number of the topic you would like to tour"),
......
......@@ -8,8 +8,15 @@ type IpnsEntry struct {
}
var nameCmd = &cmds.Command{
Description: "IPFS namespace (IPNS) tool",
Help: `IPNS is a PKI namespace, where names are the hashes of public keys, and
Helptext: cmds.HelpText{
Tagline: "IPFS namespace (IPNS) tool",
ShortDescription: `
IPNS is a PKI namespace, where names are the hashes of public keys, and
the private key enables publishing new (signed) values. In both publish
and resolve, the default value of <name> is your own identity public key.
`,
LongDescription: `
IPNS is a PKI namespace, where names are the hashes of public keys, and
the private key enables publishing new (signed) values. In both publish
and resolve, the default value of <name> is your own identity public key.
......@@ -37,6 +44,7 @@ Resolve the value of another name:
QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy
`,
},
Subcommands: map[string]*cmds.Command{
"publish": publishCmd,
......
......@@ -24,8 +24,10 @@ type Node struct {
}
var objectCmd = &cmds.Command{
Description: "Interact with ipfs objects",
Help: `'ipfs object' is a plumbing command used to manipulate DAG objects directly.`,
Helptext: cmds.HelpText{
Tagline: "Interact with ipfs objects",
ShortDescription: "'ipfs object' is a plumbing command used to manipulate DAG objects directly.",
},
Subcommands: map[string]*cmds.Command{
"data": objectDataCmd,
......@@ -36,13 +38,16 @@ var objectCmd = &cmds.Command{
}
var objectDataCmd = &cmds.Command{
Description: "Outputs the raw bytes in an IPFS object",
Help: `ipfs data is a plumbing command for retreiving the raw bytes stored in a DAG node.
Helptext: cmds.HelpText{
Tagline: "Outputs the raw bytes in an IPFS object",
ShortDescription: `
ipfs data is a plumbing command for retreiving the raw bytes stored in a DAG node.
It outputs to stdout, and <key> is a base58 encoded multihash.
Note that the "--encoding" option does not affect the output, since the
output is the raw data of the object.
`,
},
Arguments: []cmds.Argument{
cmds.StringArg("key", true, false, "Key of the object to retrieve, in base58-encoded multihash format"),
......@@ -63,9 +68,13 @@ output is the raw data of the object.
}
var objectLinksCmd = &cmds.Command{
Description: "Outputs the links pointed to by the specified object",
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: "Outputs the links pointed to by the specified object",
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, "Key of the object to retrieve, in base58-encoded multihash format"),
......@@ -87,8 +96,15 @@ It outputs to stdout, and <key> is a base58 encoded multihash.`,
}
var objectGetCmd = &cmds.Command{
Description: "Get and serialize the DAG node named by <key>",
Help: `'ipfs object get' is a plumbing command for retreiving DAG nodes.
Helptext: cmds.HelpText{
Tagline: "Get and serialize the DAG node named by <key>",
ShortDescription: `
'ipfs object get' is a plumbing command for retreiving DAG nodes.
It serializes the DAG node to the format specified by the "--encoding" flag.
It outputs to stdout, and <key> is a base58 encoded multihash.
`,
LongDescription: `
'ipfs object get' is a plumbing command for retreiving DAG nodes.
It serializes the DAG node to the format specified by the "--encoding" flag.
It outputs to stdout, and <key> is a base58 encoded multihash.
......@@ -97,6 +113,7 @@ This command outputs data in the following encodings:
* "json"
* "xml"
(Specified by the "--encoding" or "-enc" flags)`,
},
Arguments: []cmds.Argument{
cmds.StringArg("key", true, false, "Key of the object to retrieve\n(in base58-encoded multihash format)"),
......@@ -142,8 +159,14 @@ This command outputs data in the following encodings:
}
var objectPutCmd = &cmds.Command{
Description: "Stores input as a DAG object, outputs its key",
Help: `'ipfs object put' is a plumbing command for storing DAG nodes.
Helptext: cmds.HelpText{
Tagline: "Stores input as a DAG object, outputs its key",
ShortDescription: `
'ipfs object put' is a plumbing command for storing DAG nodes.
It reads from stdin, and the output is a base58 encoded multihash.
`,
LongDescription: `
'ipfs object put' is a plumbing command for storing DAG nodes.
It reads from stdin, and the output is a base58 encoded multihash.
Data should be in the format specified by <encoding>.
......@@ -151,6 +174,7 @@ Data should be in the format specified by <encoding>.
* "protobuf"
* "json"
`,
},
Arguments: []cmds.Argument{
cmds.FileArg("data", true, false, "Data to be stored as a DAG object\nMust be encoded as specified in <encoding>"),
......
......@@ -19,10 +19,13 @@ var pinCmd = &cmds.Command{
}
var addPinCmd = &cmds.Command{
Description: "Pins objects to local storage",
Help: `Retrieves the object named by <ipfs-path> and stores it locally
Helptext: cmds.HelpText{
Tagline: "Pins objects to local storage",
ShortDescription: `
Retrieves the object named by <ipfs-path> and stores it locally
on disk.
`,
},
Arguments: []cmds.Argument{
cmds.StringArg("ipfs-path", true, true, "Path to object(s) to be pinned"),
......@@ -61,10 +64,13 @@ on disk.
}
var rmPinCmd = &cmds.Command{
Description: "Unpin an object from local storage",
Help: `Removes the pin from the given object allowing it to be garbage
Helptext: cmds.HelpText{
Tagline: "Unpin an object from local storage",
ShortDescription: `
Removes the pin from the given object allowing it to be garbage
collected if needed.
`,
},
Arguments: []cmds.Argument{
cmds.StringArg("ipfs-path", true, true, "Path to object(s) to be unpinned"),
......
......@@ -16,13 +16,17 @@ type RefsOutput struct {
}
var refsCmd = &cmds.Command{
Description: "Lists link hashes from an object",
Help: `Retrieves the object named by <ipfs-path> and displays the link
Helptext: cmds.HelpText{
Tagline: "Lists link hashes from an object",
ShortDescription: `
Retrieves the object named by <ipfs-path> and displays the link
hashes it contains, with the following format:
<link base58 hash>
Note: list all refs recursively with -r.`,
Note: list all refs recursively with -r.
`,
},
Arguments: []cmds.Argument{
cmds.StringArg("ipfs-path", true, true, "Path to the object(s) to list refs from"),
......
......@@ -8,8 +8,15 @@ import (
)
var resolveCmd = &cmds.Command{
Description: "Gets the value currently published at an IPNS name",
Help: `IPNS is a PKI namespace, where names are the hashes of public keys, and
Helptext: cmds.HelpText{
Tagline: "Gets the value currently published at an IPNS name",
ShortDescription: `
IPNS is a PKI namespace, where names are the hashes of public keys, and
the private key enables publishing new (signed) values. In resolve, the
default value of <name> is your own identity public key.
`,
LongDescription: `
IPNS is a PKI namespace, where names are the hashes of public keys, and
the private key enables publishing new (signed) values. In resolve, the
default value of <name> is your own identity public key.
......@@ -27,6 +34,7 @@ Resolve te value of another name:
QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy
`,
},
Arguments: []cmds.Argument{
cmds.StringArg("name", false, false, "The IPNS name to resolve. Defaults to your node's peerID."),
......
......@@ -15,9 +15,10 @@ type UpdateOutput struct {
}
var updateCmd = &cmds.Command{
Description: "Downloads and installs updates for IPFS",
Help: `ipfs update is a utility command used to check for updates and apply them.
`,
Helptext: cmds.HelpText{
Tagline: "Downloads and installs updates for IPFS",
ShortDescription: "ipfs update is a utility command used to check for updates and apply them.",
},
Run: func(req cmds.Request) (interface{}, error) {
n, err := req.Context().GetNode()
......@@ -47,11 +48,14 @@ var updateCmd = &cmds.Command{
}
var updateCheckCmd = &cmds.Command{
Description: "Checks if updates are available",
Help: `'ipfs update check' checks if any updates are available for IPFS.
Helptext: cmds.HelpText{
Tagline: "Checks if updates are available",
ShortDescription: `
'ipfs update check' checks if any updates are available for IPFS.
Nothing will be downloaded or installed.
`,
},
Run: func(req cmds.Request) (interface{}, error) {
n, err := req.Context().GetNode()
......@@ -77,9 +81,10 @@ Nothing will be downloaded or installed.
}
var updateLogCmd = &cmds.Command{
Description: "List the changelog for the latest versions of IPFS",
Help: `This command is not yet implemented.
`,
Helptext: cmds.HelpText{
Tagline: "List the changelog for the latest versions of IPFS",
ShortDescription: "This command is not yet implemented.",
},
Run: func(req cmds.Request) (interface{}, error) {
n, err := req.Context().GetNode()
......
......@@ -10,9 +10,10 @@ type VersionOutput struct {
}
var versionCmd = &cmds.Command{
Description: "Outputs the current version of IPFS",
Help: `Returns the version number of IPFS and exits.
`,
Helptext: cmds.HelpText{
Tagline: "Outputs the current version of IPFS",
ShortDescription: "Returns the version number of IPFS and exits.",
},
Options: []cmds.Option{
cmds.BoolOption("number", "n", "Only output the version number"),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment