@cryptotaxi247 / kubo / commits / 2f008d47c

refact(command): replace option name with const string

License: MIT Signed-off-by: chenminjian <727180553@qq.com>

chenminjian committed Oct 25, 2018 at 15:13 UTC 2f008d47cdffef24a6c9e7b3a828df370ba60e06
1 file changed +10 -7
core/commands/root.go
+10 -7
@@ -13,7 +13,7 @@ import (
13 ocmd "github.com/ipfs/go-ipfs/core/commands/object"
14 unixfs "github.com/ipfs/go-ipfs/core/commands/unixfs"
15
16 - "gx/ipfs/QmRRovo1DE6i5cMjCbf19mQCSuszF6SKwdZNUMS7MtBnH1/go-ipfs-cmds"
16 + cmds "gx/ipfs/QmRRovo1DE6i5cMjCbf19mQCSuszF6SKwdZNUMS7MtBnH1/go-ipfs-cmds"
17 logging "gx/ipfs/QmZChCsSt8DctjceaL56Eibc29CVQq4dGKRXC5JRZ6Ppae/go-log"
18 "gx/ipfs/Qmde5VP1qUkyQXKCfmEUA7bP64V2HAptbJ7phuPp7jXWwg/go-ipfs-cmdkit"
19 )
@@ -23,7 +23,10 @@ var log = logging.Logger("core/commands")
23 var ErrNotOnline = errors.New("this command must be run in online mode. Try running 'ipfs daemon' first")
24
25 const (
26 - ApiOption = "api"
26 + ConfigOption = "config"
27 + DebugOption = "debug"
28 + LocalOption = "local"
29 + ApiOption = "api"
30 )
31
32 var Root = &cmds.Command{
@@ -90,11 +93,11 @@ The CLI will exit with one of the following values:
93 `,
94 },
95 Options: []cmdkit.Option{
93 - cmdkit.StringOption("config", "c", "Path to the configuration file to use."),
94 - cmdkit.BoolOption("debug", "D", "Operate in debug mode."),
95 - cmdkit.BoolOption("help", "Show the full command help text."),
96 - cmdkit.BoolOption("h", "Show a short version of the command help text."),
97 - cmdkit.BoolOption("local", "L", "Run the command locally, instead of using the daemon."),
96 + cmdkit.StringOption(ConfigOption, "c", "Path to the configuration file to use."),
97 + cmdkit.BoolOption(DebugOption, "D", "Operate in debug mode."),
98 + cmdkit.BoolOption(cmds.OptLongHelp, "Show the full command help text."),
99 + cmdkit.BoolOption(cmds.OptShortHelp, "Show a short version of the command help text."),
100 + cmdkit.BoolOption(LocalOption, "L", "Run the command locally, instead of using the daemon."),
101 cmdkit.StringOption(ApiOption, "Use a specific API instance (defaults to /ip4/127.0.0.1/tcp/5001)"),
102
103 // global options, added to every command