提交 65c6bd07 作者: Brian Tiger Chow

feat(core/commands): expose commands to allow for the development of high-level interface

+ style: sort command list

License: MIT
Signed-off-by: 's avatarBrian Tiger Chow <brian@perfmode.com>
上级 229c93f7
...@@ -26,7 +26,7 @@ type AddOutput struct { ...@@ -26,7 +26,7 @@ type AddOutput struct {
Quiet bool Quiet bool
} }
var addCmd = &cmds.Command{ var AddCmd = &cmds.Command{
Helptext: cmds.HelpText{ Helptext: cmds.HelpText{
Tagline: "Add an object to ipfs.", Tagline: "Add an object to ipfs.",
ShortDescription: ` ShortDescription: `
......
...@@ -18,7 +18,7 @@ type Block struct { ...@@ -18,7 +18,7 @@ type Block struct {
Length int Length int
} }
var blockCmd = &cmds.Command{ var BlockCmd = &cmds.Command{
Helptext: cmds.HelpText{ Helptext: cmds.HelpText{
Tagline: "Manipulate raw IPFS blocks", Tagline: "Manipulate raw IPFS blocks",
ShortDescription: ` ShortDescription: `
......
...@@ -19,7 +19,7 @@ type BootstrapOutput struct { ...@@ -19,7 +19,7 @@ type BootstrapOutput struct {
var peerOptionDesc = "A peer to add to the bootstrap list (in the format '<multiaddr>/<peerID>')" var peerOptionDesc = "A peer to add to the bootstrap list (in the format '<multiaddr>/<peerID>')"
var bootstrapCmd = &cmds.Command{ var BootstrapCmd = &cmds.Command{
Helptext: cmds.HelpText{ Helptext: cmds.HelpText{
Tagline: "Show or edit the list of bootstrap peers", Tagline: "Show or edit the list of bootstrap peers",
Synopsis: ` Synopsis: `
......
...@@ -8,7 +8,7 @@ import ( ...@@ -8,7 +8,7 @@ import (
uio "github.com/jbenet/go-ipfs/unixfs/io" uio "github.com/jbenet/go-ipfs/unixfs/io"
) )
var catCmd = &cmds.Command{ var CatCmd = &cmds.Command{
Helptext: cmds.HelpText{ Helptext: cmds.HelpText{
Tagline: "Show IPFS object data", Tagline: "Show IPFS object data",
ShortDescription: ` ShortDescription: `
......
...@@ -19,7 +19,7 @@ type ConfigField struct { ...@@ -19,7 +19,7 @@ type ConfigField struct {
Value interface{} Value interface{}
} }
var configCmd = &cmds.Command{ var ConfigCmd = &cmds.Command{
Helptext: cmds.HelpText{ Helptext: cmds.HelpText{
Tagline: "get and set IPFS config values", Tagline: "get and set IPFS config values",
Synopsis: ` Synopsis: `
......
...@@ -31,7 +31,7 @@ type IdOutput struct { ...@@ -31,7 +31,7 @@ type IdOutput struct {
ProtocolVersion string ProtocolVersion string
} }
var idCmd = &cmds.Command{ var IDCmd = &cmds.Command{
Helptext: cmds.HelpText{ Helptext: cmds.HelpText{
Tagline: "Show IPFS Node ID info", Tagline: "Show IPFS Node ID info",
ShortDescription: ` ShortDescription: `
......
...@@ -21,7 +21,7 @@ type LsOutput struct { ...@@ -21,7 +21,7 @@ type LsOutput struct {
Objects []Object Objects []Object
} }
var lsCmd = &cmds.Command{ var LsCmd = &cmds.Command{
Helptext: cmds.HelpText{ Helptext: cmds.HelpText{
Tagline: "List links from an object.", Tagline: "List links from an object.",
ShortDescription: ` ShortDescription: `
......
...@@ -22,7 +22,7 @@ const mountTimeout = time.Second ...@@ -22,7 +22,7 @@ const mountTimeout = time.Second
// fuseNoDirectory used to check the returning fuse error // fuseNoDirectory used to check the returning fuse error
const fuseNoDirectory = "fusermount: failed to access mountpoint" const fuseNoDirectory = "fusermount: failed to access mountpoint"
var mountCmd = &cmds.Command{ var MountCmd = &cmds.Command{
Helptext: cmds.HelpText{ Helptext: cmds.HelpText{
Tagline: "Mounts IPFS to the filesystem (read-only)", Tagline: "Mounts IPFS to the filesystem (read-only)",
Synopsis: ` Synopsis: `
......
...@@ -7,7 +7,7 @@ type IpnsEntry struct { ...@@ -7,7 +7,7 @@ type IpnsEntry struct {
Value string Value string
} }
var nameCmd = &cmds.Command{ var NameCmd = &cmds.Command{
Helptext: cmds.HelpText{ Helptext: cmds.HelpText{
Tagline: "IPFS namespace (IPNS) tool", Tagline: "IPFS namespace (IPNS) tool",
Synopsis: ` Synopsis: `
......
...@@ -24,7 +24,7 @@ type Node struct { ...@@ -24,7 +24,7 @@ type Node struct {
Data []byte Data []byte
} }
var objectCmd = &cmds.Command{ var ObjectCmd = &cmds.Command{
Helptext: cmds.HelpText{ Helptext: cmds.HelpText{
Tagline: "Interact with ipfs objects", Tagline: "Interact with ipfs objects",
ShortDescription: ` ShortDescription: `
......
...@@ -9,7 +9,7 @@ import ( ...@@ -9,7 +9,7 @@ import (
u "github.com/jbenet/go-ipfs/util" u "github.com/jbenet/go-ipfs/util"
) )
var pinCmd = &cmds.Command{ var PinCmd = &cmds.Command{
Helptext: cmds.HelpText{ Helptext: cmds.HelpText{
Tagline: "Pin (and unpin) objects to local storage", Tagline: "Pin (and unpin) objects to local storage",
}, },
......
...@@ -25,7 +25,7 @@ func KeyListTextMarshaler(res cmds.Response) ([]byte, error) { ...@@ -25,7 +25,7 @@ func KeyListTextMarshaler(res cmds.Response) ([]byte, error) {
return []byte(s), nil return []byte(s), nil
} }
var refsCmd = &cmds.Command{ var RefsCmd = &cmds.Command{
Helptext: cmds.HelpText{ Helptext: cmds.HelpText{
Tagline: "Lists link hashes from an object", Tagline: "Lists link hashes from an object",
ShortDescription: ` ShortDescription: `
......
...@@ -62,24 +62,24 @@ Use 'ipfs <command> --help' to learn more about each command. ...@@ -62,24 +62,24 @@ Use 'ipfs <command> --help' to learn more about each command.
var CommandsDaemonCmd = CommandsCmd(Root) var CommandsDaemonCmd = CommandsCmd(Root)
var rootSubcommands = map[string]*cmds.Command{ var rootSubcommands = map[string]*cmds.Command{
"cat": catCmd, "add": AddCmd,
"ls": lsCmd, "block": BlockCmd,
"bootstrap": BootstrapCmd,
"cat": CatCmd,
"commands": CommandsDaemonCmd, "commands": CommandsDaemonCmd,
"name": nameCmd, "config": ConfigCmd,
"add": addCmd,
"log": LogCmd,
"diag": DiagCmd, "diag": DiagCmd,
"pin": pinCmd, "id": IDCmd,
"version": VersionCmd, "log": LogCmd,
"config": configCmd, "ls": LsCmd,
"bootstrap": bootstrapCmd, "mount": MountCmd,
"mount": mountCmd, "name": NameCmd,
"block": blockCmd, "object": ObjectCmd,
"pin": PinCmd,
"refs": RefsCmd,
"swarm": SwarmCmd,
"update": UpdateCmd, "update": UpdateCmd,
"object": objectCmd, "version": VersionCmd,
"refs": refsCmd,
"id": idCmd,
"swarm": swarmCmd,
} }
func init() { func init() {
......
...@@ -17,7 +17,7 @@ type stringList struct { ...@@ -17,7 +17,7 @@ type stringList struct {
Strings []string Strings []string
} }
var swarmCmd = &cmds.Command{ var SwarmCmd = &cmds.Command{
Helptext: cmds.HelpText{ Helptext: cmds.HelpText{
Tagline: "swarm inspection tool", Tagline: "swarm inspection tool",
Synopsis: ` Synopsis: `
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论