Added Default false to all remaining options
Specifically, to `repo`, `resolve`, `swarm`, and `version`. Part of #2484. License: MIT Signed-off-by: Richard Littauer <richard.littauer@gmail.com>
Richard Littauer committed
May 12, 2016 at 12:02 UTC
f52050de8065bb559755299e054779b559c1a0a4
4 files changed
+11
-11
core/commands/repo.go
+2
-2
@@ -38,7 +38,7 @@ order to reclaim hard disk space.
38
`,
39
},
40
Options: []cmds.Option{
41
- cmds.BoolOption("quiet", "q", "Write minimal output."),
41
+ cmds.BoolOption("quiet", "q", "Write minimal output.").Default(false),
42
},
43
Run: func(req cmds.Request, res cmds.Response) {
44
n, err := req.InvocContext().GetNode()
@@ -127,7 +127,7 @@ RepoSize int Size in bytes that the repo is currently taking.
127
res.SetOutput(stat)
128
},
129
Options: []cmds.Option{
130
- cmds.BoolOption("human", "Output RepoSize in MiB."),
130
+ cmds.BoolOption("human", "Output RepoSize in MiB.").Default(false),
131
},
132
Type: corerepo.Stat{},
133
Marshalers: cmds.MarshalerMap{
core/commands/resolve.go
+1
-1
@@ -59,7 +59,7 @@ Resolve the value of an IPFS DAG path:
59
cmds.StringArg("name", true, false, "The name to resolve.").EnableStdin(),
60
},
61
Options: []cmds.Option{
62
- cmds.BoolOption("recursive", "r", "Resolve until the result is an IPFS name. Default: false."),
62
+ cmds.BoolOption("recursive", "r", "Resolve until the result is an IPFS name.").Default(false),
63
},
64
Run: func(req cmds.Request, res cmds.Response) {
65
core/commands/swarm.go
+1
-1
@@ -152,7 +152,7 @@ var swarmAddrsLocalCmd = &cmds.Command{
152
`,
153
},
154
Options: []cmds.Option{
155
- cmds.BoolOption("id", "Show peer ID in addresses."),
155
+ cmds.BoolOption("id", "Show peer ID in addresses.").Default(false),
156
},
157
Run: func(req cmds.Request, res cmds.Response) {
158
core/commands/version.go
+7
-7
@@ -23,9 +23,9 @@ var VersionCmd = &cmds.Command{
23
},
24
25
Options: []cmds.Option{
26
- cmds.BoolOption("number", "n", "Only show the version number."),
27
- cmds.BoolOption("commit", "Show the commit hash."),
28
- cmds.BoolOption("repo", "Show repo version."),
26
+ cmds.BoolOption("number", "n", "Only show the version number.").Default(false),
27
+ cmds.BoolOption("commit", "Show the commit hash.").Default(false),
28
+ cmds.BoolOption("repo", "Show repo version.").Default(false),
29
},
30
Run: func(req cmds.Request, res cmds.Response) {
31
res.SetOutput(&VersionOutput{
@@ -47,20 +47,20 @@ var VersionCmd = &cmds.Command{
47
return strings.NewReader(v.Repo + "\n"), nil
48
}
49
50
- commit, found, err := res.Request().Option("commit").Bool()
50
+ commit, _, err := res.Request().Option("commit").Bool()
51
commitTxt := ""
52
if err != nil {
53
return nil, err
54
}
55
- if found && commit {
55
+ if commit {
56
commitTxt = "-" + v.Commit
57
}
58
59
- number, found, err := res.Request().Option("number").Bool()
59
+ number, _, err := res.Request().Option("number").Bool()
60
if err != nil {
61
return nil, err
62
}
63
- if found && number {
63
+ if number {
64
return strings.NewReader(fmt.Sprintln(v.Version + commitTxt)), nil
65
}
66