remove all instances of `Default(false)`
Boolean options always default to false. License: MIT Signed-off-by: Lorenzo Manacorda <lorenzo@mailbox.org>
Lorenzo Manacorda committed
Jul 6, 2017 at 10:57 UTC
57f544a79cdd8b4f6a0c1f4bce1c750985708b22
24 files changed
+55
-55
cmd/ipfs/daemon.go
+7
-7
@@ -144,17 +144,17 @@ Headers.
144
},
145
146
Options: []cmdkit.Option{
147
- cmdkit.BoolOption(initOptionKwd, "Initialize ipfs with default settings if not already initialized").Default(false),
147
+ cmdkit.BoolOption(initOptionKwd, "Initialize ipfs with default settings if not already initialized"),
148
cmdkit.StringOption(routingOptionKwd, "Overrides the routing option").Default("dht"),
149
- cmdkit.BoolOption(mountKwd, "Mounts IPFS to the filesystem").Default(false),
150
- cmdkit.BoolOption(writableKwd, "Enable writing objects (with POST, PUT and DELETE)").Default(false),
149
+ cmdkit.BoolOption(mountKwd, "Mounts IPFS to the filesystem"),
150
+ cmdkit.BoolOption(writableKwd, "Enable writing objects (with POST, PUT and DELETE)"),
151
cmdkit.StringOption(ipfsMountKwd, "Path to the mountpoint for IPFS (if using --mount). Defaults to config setting."),
152
cmdkit.StringOption(ipnsMountKwd, "Path to the mountpoint for IPNS (if using --mount). Defaults to config setting."),
153
- cmdkit.BoolOption(unrestrictedApiAccessKwd, "Allow API access to unlisted hashes").Default(false),
154
- cmdkit.BoolOption(unencryptTransportKwd, "Disable transport encryption (for debugging protocols)").Default(false),
155
- cmdkit.BoolOption(enableGCKwd, "Enable automatic periodic repo garbage collection").Default(false),
153
+ cmdkit.BoolOption(unrestrictedApiAccessKwd, "Allow API access to unlisted hashes"),
154
+ cmdkit.BoolOption(unencryptTransportKwd, "Disable transport encryption (for debugging protocols)"),
155
+ cmdkit.BoolOption(enableGCKwd, "Enable automatic periodic repo garbage collection"),
156
cmdkit.BoolOption(adjustFDLimitKwd, "Check and raise file descriptor limits if needed").Default(true),
157
- cmdkit.BoolOption(offlineKwd, "Run offline. Do not connect to the rest of the network but provide local API.").Default(false),
157
+ cmdkit.BoolOption(offlineKwd, "Run offline. Do not connect to the rest of the network but provide local API."),
158
cmdkit.BoolOption(migrateKwd, "If true, assume yes at the migrate prompt. If false, assume no."),
159
cmdkit.BoolOption(enableFloodSubKwd, "Instantiate the ipfs daemon with the experimental pubsub feature enabled."),
160
cmdkit.BoolOption(enableMultiplexKwd, "Add the experimental 'go-multiplex' stream muxer to libp2p on construction.").Default(true),
cmd/ipfs/init.go
+1
-1
@@ -51,7 +51,7 @@ environment variable:
51
},
52
Options: []cmdkit.Option{
53
cmdkit.IntOption("bits", "b", "Number of bits to use in the generated RSA private key.").Default(nBitsForKeypairDefault),
54
- cmdkit.BoolOption("empty-repo", "e", "Don't add and pin help files to the local storage.").Default(false),
54
+ cmdkit.BoolOption("empty-repo", "e", "Don't add and pin help files to the local storage."),
55
cmdkit.StringOption("profile", "p", "Apply profile settings to config. Multiple profiles can be separated by ','"),
56
57
// TODO need to decide whether to expose the override as a file or a
core/commands/active.go
+1
-1
@@ -25,7 +25,7 @@ Lists running and recently run commands.
25
res.SetOutput(req.InvocContext().ReqLog.Report())
26
},
27
Options: []cmdkit.Option{
28
- cmdkit.BoolOption("verbose", "v", "Print extra information.").Default(false),
28
+ cmdkit.BoolOption("verbose", "v", "Print extra information."),
29
},
30
Subcommands: map[string]*cmds.Command{
31
"clear": clearInactiveCmd,
core/commands/block.go
+2
-2
@@ -260,8 +260,8 @@ It takes a list of base58 encoded multihashs to remove.
260
cmdkit.StringArg("hash", true, true, "Bash58 encoded multihash of block(s) to remove."),
261
},
262
Options: []cmdkit.Option{
263
- cmdkit.BoolOption("force", "f", "Ignore nonexistent blocks.").Default(false),
264
- cmdkit.BoolOption("quiet", "q", "Write minimal output.").Default(false),
263
+ cmdkit.BoolOption("force", "f", "Ignore nonexistent blocks."),
264
+ cmdkit.BoolOption("quiet", "q", "Write minimal output."),
265
},
266
Run: func(req cmds.Request, res cmds.ResponseEmitter) {
267
n, err := req.InvocContext().GetNode()
core/commands/commands.go
+1
-1
@@ -67,7 +67,7 @@ func CommandsCmd(root *cmds.Command) *cmds.Command {
67
ShortDescription: `Lists all available commands (and subcommands) and exits.`,
68
},
69
Options: []cmdkit.Option{
70
- cmdkit.BoolOption(flagsOptionName, "f", "Show command flags").Default(false),
70
+ cmdkit.BoolOption(flagsOptionName, "f", "Show command flags"),
71
},
72
Run: func(req cmds.Request, res cmds.ResponseEmitter) {
73
rootCmd := cmd2outputCmd("ipfs", root)
core/commands/config.go
+2
-2
@@ -54,8 +54,8 @@ Set the value of the 'Datastore.Path' key:
54
cmdkit.StringArg("value", false, false, "The value to set the config entry to."),
55
},
56
Options: []cmdkit.Option{
57
- cmdkit.BoolOption("bool", "Set a boolean value.").Default(false),
58
- cmdkit.BoolOption("json", "Parse stringified JSON.").Default(false),
57
+ cmdkit.BoolOption("bool", "Set a boolean value."),
58
+ cmdkit.BoolOption("json", "Parse stringified JSON."),
59
},
60
Run: func(req cmds.Request, res cmds.Response) {
61
args := req.Arguments()
core/commands/dag/dag.go
+1
-1
@@ -61,7 +61,7 @@ into an object of the specified format.
61
Options: []cmdkit.Option{
62
cmdkit.StringOption("format", "f", "Format that the object will be added as.").Default("cbor"),
63
cmdkit.StringOption("input-enc", "Format that the input object will be.").Default("json"),
64
- cmdkit.BoolOption("pin", "Pin this object when adding.").Default(false),
64
+ cmdkit.BoolOption("pin", "Pin this object when adding."),
65
cmdkit.StringOption("hash", "Hash function to use").Default(""),
66
},
67
Run: func(req cmds.Request, res cmds.Response) {
core/commands/dht.go
+7
-7
@@ -51,7 +51,7 @@ var queryDhtCmd = &cmds.Command{
51
cmdkit.StringArg("peerID", true, true, "The peerID to run the query against."),
52
},
53
Options: []cmdkit.Option{
54
- cmdkit.BoolOption("verbose", "v", "Print extra information.").Default(false),
54
+ cmdkit.BoolOption("verbose", "v", "Print extra information."),
55
},
56
Run: func(req cmds.Request, res cmds.Response) {
57
n, err := req.InvocContext().GetNode()
@@ -139,7 +139,7 @@ var findProvidersDhtCmd = &cmds.Command{
139
cmdkit.StringArg("key", true, true, "The key to find providers for."),
140
},
141
Options: []cmdkit.Option{
142
- cmdkit.BoolOption("verbose", "v", "Print extra information.").Default(false),
142
+ cmdkit.BoolOption("verbose", "v", "Print extra information."),
143
cmdkit.IntOption("num-providers", "n", "The number of providers to find.").Default(20),
144
},
145
Run: func(req cmds.Request, res cmds.Response) {
@@ -248,8 +248,8 @@ var provideRefDhtCmd = &cmds.Command{
248
cmdkit.StringArg("key", true, true, "The key[s] to send provide records for.").EnableStdin(),
249
},
250
Options: []cmdkit.Option{
251
- cmdkit.BoolOption("verbose", "v", "Print extra information.").Default(false),
252
- cmdkit.BoolOption("recursive", "r", "Recursively provide entire graph.").Default(false),
251
+ cmdkit.BoolOption("verbose", "v", "Print extra information."),
252
+ cmdkit.BoolOption("recursive", "r", "Recursively provide entire graph."),
253
},
254
Run: func(req cmds.Request, res cmds.Response) {
255
n, err := req.InvocContext().GetNode()
@@ -397,7 +397,7 @@ var findPeerDhtCmd = &cmds.Command{
397
cmdkit.StringArg("peerID", true, true, "The ID of the peer to search for."),
398
},
399
Options: []cmdkit.Option{
400
- cmdkit.BoolOption("verbose", "v", "Print extra information.").Default(false),
400
+ cmdkit.BoolOption("verbose", "v", "Print extra information."),
401
},
402
Run: func(req cmds.Request, res cmds.Response) {
403
n, err := req.InvocContext().GetNode()
@@ -499,7 +499,7 @@ Different key types can specify other 'best' rules.
499
cmdkit.StringArg("key", true, true, "The key to find a value for."),
500
},
501
Options: []cmdkit.Option{
502
- cmdkit.BoolOption("verbose", "v", "Print extra information.").Default(false),
502
+ cmdkit.BoolOption("verbose", "v", "Print extra information."),
503
},
504
Run: func(req cmds.Request, res cmds.Response) {
505
n, err := req.InvocContext().GetNode()
@@ -611,7 +611,7 @@ NOTE: A value may not exceed 2048 bytes.
611
cmdkit.StringArg("value", true, false, "The value to store.").EnableStdin(),
612
},
613
Options: []cmdkit.Option{
614
- cmdkit.BoolOption("verbose", "v", "Print extra information.").Default(false),
614
+ cmdkit.BoolOption("verbose", "v", "Print extra information."),
615
},
616
Run: func(req cmds.Request, res cmds.Response) {
617
n, err := req.InvocContext().GetNode()
core/commands/dns.go
+1
-1
@@ -49,7 +49,7 @@ The resolver can recursively resolve:
49
cmdkit.StringArg("domain-name", true, false, "The domain-name name to resolve.").EnableStdin(),
50
},
51
Options: []cmdkit.Option{
52
- cmdkit.BoolOption("recursive", "r", "Resolve until the result is not a DNS link.").Default(false),
52
+ cmdkit.BoolOption("recursive", "r", "Resolve until the result is not a DNS link."),
53
},
54
Run: func(req cmds.Request, res cmds.Response) {
55
core/commands/files/files.go
+2
-2
@@ -83,8 +83,8 @@ Size: <size>
83
CumulativeSize: <cumulsize>
84
ChildBlocks: <childs>
85
Type: <type>`),
86
- cmdkit.BoolOption("hash", "Print only hash. Implies '--format=<hash>'. Conflicts with other format options.").Default(false),
87
- cmdkit.BoolOption("size", "Print only size. Implies '--format=<cumulsize>'. Conflicts with other format options.").Default(false),
86
+ cmdkit.BoolOption("hash", "Print only hash. Implies '--format=<hash>'. Conflicts with other format options."),
87
+ cmdkit.BoolOption("size", "Print only size. Implies '--format=<cumulsize>'. Conflicts with other format options."),
88
},
89
Run: func(req cmds.Request, res cmds.Response) {
90
core/commands/get.go
+2
-2
@@ -44,8 +44,8 @@ may also specify the level of compression by specifying '-l=<1-9>'.
44
},
45
Options: []cmdkit.Option{
46
cmdkit.StringOption("output", "o", "The path where the output should be stored."),
47
- cmdkit.BoolOption("archive", "a", "Output a TAR archive.").Default(false),
48
- cmdkit.BoolOption("compress", "C", "Compress the output with GZIP compression.").Default(false),
47
+ cmdkit.BoolOption("archive", "a", "Output a TAR archive."),
48
+ cmdkit.BoolOption("compress", "C", "Compress the output with GZIP compression."),
49
cmdkit.IntOption("compression-level", "l", "The level of compression (1-9).").Default(-1),
50
},
51
PreRun: func(req cmds.Request) error {
core/commands/ipns.go
+2
-2
@@ -55,8 +55,8 @@ Resolve the value of a dnslink:
55
cmdkit.StringArg("name", false, false, "The IPNS name to resolve. Defaults to your node's peerID."),
56
},
57
Options: []cmdkit.Option{
58
- cmdkit.BoolOption("recursive", "r", "Resolve until the result is not an IPNS name.").Default(false),
59
- cmdkit.BoolOption("nocache", "n", "Do not use cached entries.").Default(false),
58
+ cmdkit.BoolOption("recursive", "r", "Resolve until the result is not an IPNS name."),
59
+ cmdkit.BoolOption("nocache", "n", "Do not use cached entries."),
60
},
61
Run: func(req cmds.Request, res cmds.Response) {
62
core/commands/ls.go
+1
-1
@@ -53,7 +53,7 @@ The JSON output contains type information.
53
cmdkit.StringArg("ipfs-path", true, true, "The path to the IPFS object(s) to list links from.").EnableStdin(),
54
},
55
Options: []cmdkit.Option{
56
- cmdkit.BoolOption("headers", "v", "Print table headers (Hash, Size, Name).").Default(false),
56
+ cmdkit.BoolOption("headers", "v", "Print table headers (Hash, Size, Name)."),
57
cmdkit.BoolOption("resolve-type", "Resolve linked objects to find out their types.").Default(true),
58
},
59
Run: func(req cmds.Request, res cmds.Response) {
core/commands/object/object.go
+2
-2
@@ -127,7 +127,7 @@ multihash.
127
cmdkit.StringArg("key", true, false, "Key of the object to retrieve, in base58-encoded multihash format.").EnableStdin(),
128
},
129
Options: []cmdkit.Option{
130
- cmdkit.BoolOption("headers", "v", "Print table headers (Hash, Size, Name).").Default(false),
130
+ cmdkit.BoolOption("headers", "v", "Print table headers (Hash, Size, Name)."),
131
},
132
Run: func(req cmds.Request, res cmds.Response) {
133
n, err := req.InvocContext().GetNode()
@@ -384,7 +384,7 @@ And then run:
384
Options: []cmdkit.Option{
385
cmdkit.StringOption("inputenc", "Encoding type of input data. One of: {\"protobuf\", \"json\"}.").Default("json"),
386
cmdkit.StringOption("datafieldenc", "Encoding type of the data field, either \"text\" or \"base64\".").Default("text"),
387
- cmdkit.BoolOption("pin", "Pin this object when adding.").Default(false),
387
+ cmdkit.BoolOption("pin", "Pin this object when adding."),
388
},
389
Run: func(req cmds.Request, res cmds.Response) {
390
n, err := req.InvocContext().GetNode()
core/commands/object/patch.go
+1
-1
@@ -272,7 +272,7 @@ to a file containing 'bar', and returns the hash of the new object.
272
cmdkit.StringArg("ref", true, false, "IPFS object to add link to."),
273
},
274
Options: []cmdkit.Option{
275
- cmdkit.BoolOption("create", "p", "Create intermediary nodes.").Default(false),
275
+ cmdkit.BoolOption("create", "p", "Create intermediary nodes."),
276
},
277
Run: func(req cmds.Request, res cmds.Response) {
278
nd, err := req.InvocContext().GetNode()
core/commands/p2p.go
+4
-4
@@ -91,7 +91,7 @@ var p2pListenerLsCmd = &cmds.Command{
91
Tagline: "List active p2p listeners.",
92
},
93
Options: []cmdkit.Option{
94
- cmdkit.BoolOption("headers", "v", "Print table headers (HandlerID, Protocol, Local, Remote).").Default(false),
94
+ cmdkit.BoolOption("headers", "v", "Print table headers (HandlerID, Protocol, Local, Remote)."),
95
},
96
Run: func(req cmds.Request, res cmds.Response) {
97
@@ -143,7 +143,7 @@ var p2pStreamLsCmd = &cmds.Command{
143
Tagline: "List active p2p streams.",
144
},
145
Options: []cmdkit.Option{
146
- cmdkit.BoolOption("headers", "v", "Print table headers (HagndlerID, Protocol, Local, Remote).").Default(false),
146
+ cmdkit.BoolOption("headers", "v", "Print table headers (HagndlerID, Protocol, Local, Remote)."),
147
},
148
Run: func(req cmds.Request, res cmds.Response) {
149
n, err := getNode(req)
@@ -307,7 +307,7 @@ var p2pListenerCloseCmd = &cmds.Command{
307
cmdkit.StringArg("Protocol", false, false, "P2P listener protocol"),
308
},
309
Options: []cmdkit.Option{
310
- cmdkit.BoolOption("all", "a", "Close all listeners.").Default(false),
310
+ cmdkit.BoolOption("all", "a", "Close all listeners."),
311
},
312
Run: func(req cmds.Request, res cmds.Response) {
313
res.SetOutput(nil)
@@ -350,7 +350,7 @@ var p2pStreamCloseCmd = &cmds.Command{
350
cmdkit.StringArg("HandlerID", false, false, "Stream HandlerID"),
351
},
352
Options: []cmdkit.Option{
353
- cmdkit.BoolOption("all", "a", "Close all streams.").Default(false),
353
+ cmdkit.BoolOption("all", "a", "Close all streams."),
354
},
355
Run: func(req cmds.Request, res cmds.Response) {
356
res.SetOutput(nil)
core/commands/pin.go
+1
-1
@@ -276,7 +276,7 @@ Example:
276
},
277
Options: []cmdkit.Option{
278
cmdkit.StringOption("type", "t", "The type of pinned keys to list. Can be \"direct\", \"indirect\", \"recursive\", or \"all\".").Default("all"),
279
- cmdkit.BoolOption("quiet", "q", "Write just hashes of objects.").Default(false),
279
+ cmdkit.BoolOption("quiet", "q", "Write just hashes of objects."),
280
},
281
Run: func(req cmds.Request, res cmds.Response) {
282
n, err := req.InvocContext().GetNode()
core/commands/refs.go
+3
-3
@@ -62,9 +62,9 @@ NOTE: List all references recursively by using the flag '-r'.
62
},
63
Options: []cmdkit.Option{
64
cmdkit.StringOption("format", "Emit edges with given format. Available tokens: <src> <dst> <linkname>.").Default("<dst>"),
65
- cmdkit.BoolOption("edges", "e", "Emit edge format: `<from> -> <to>`.").Default(false),
66
- cmdkit.BoolOption("unique", "u", "Omit duplicate refs from output.").Default(false),
67
- cmdkit.BoolOption("recursive", "r", "Recursively list links of child nodes.").Default(false),
65
+ cmdkit.BoolOption("edges", "e", "Emit edge format: `<from> -> <to>`."),
66
+ cmdkit.BoolOption("unique", "u", "Omit duplicate refs from output."),
67
+ cmdkit.BoolOption("recursive", "r", "Recursively list links of child nodes."),
68
},
69
Run: func(req cmds.Request, res cmds.Response) {
70
ctx := req.Context()
core/commands/repo.go
+3
-3
@@ -61,8 +61,8 @@ order to reclaim hard disk space.
61
`,
62
},
63
Options: []cmdkit.Option{
64
- cmdkit.BoolOption("stream-errors", "Stream errors.").Default(false),
65
- cmdkit.BoolOption("quiet", "q", "Write minimal output.").Default(false),
64
+ cmdkit.BoolOption("stream-errors", "Stream errors."),
65
+ cmdkit.BoolOption("quiet", "q", "Write minimal output."),
66
},
67
Run: func(req oldcmds.Request, res oldcmds.Response) {
68
n, err := req.InvocContext().GetNode()
@@ -165,7 +165,7 @@ Version string The repo version.
165
cmds.EmitOnce(res, stat)
166
},
167
Options: []cmdkit.Option{
168
- cmdkit.BoolOption("human", "Output RepoSize in MiB.").Default(false),
168
+ cmdkit.BoolOption("human", "Output RepoSize in MiB."),
169
},
170
Type: corerepo.Stat{},
171
Encoders: cmds.EncoderMap{
core/commands/resolve.go
+1
-1
@@ -61,7 +61,7 @@ Resolve the value of an IPFS DAG path:
61
cmdkit.StringArg("name", true, false, "The name to resolve.").EnableStdin(),
62
},
63
Options: []cmdkit.Option{
64
- cmdkit.BoolOption("recursive", "r", "Resolve until the result is an IPFS name.").Default(false),
64
+ cmdkit.BoolOption("recursive", "r", "Resolve until the result is an IPFS name."),
65
},
66
Run: func(req cmds.Request, res cmds.Response) {
67
core/commands/root.go
+4
-4
@@ -86,10 +86,10 @@ The CLI will exit with one of the following values:
86
},
87
Options: []cmdkit.Option{
88
cmdkit.StringOption("config", "c", "Path to the configuration file to use."),
89
- cmdkit.BoolOption("debug", "D", "Operate in debug mode.").Default(false),
90
- cmdkit.BoolOption("help", "Show the full command help text.").Default(false),
91
- cmdkit.BoolOption("h", "Show a short version of the command help text.").Default(false),
92
- cmdkit.BoolOption("local", "L", "Run the command locally, instead of using the daemon.").Default(false),
89
+ cmdkit.BoolOption("debug", "D", "Operate in debug mode."),
90
+ cmdkit.BoolOption("help", "Show the full command help text."),
91
+ cmdkit.BoolOption("h", "Show a short version of the command help text."),
92
+ cmdkit.BoolOption("local", "L", "Run the command locally, instead of using the daemon."),
93
cmdkit.StringOption(ApiOption, "Use a specific API instance (defaults to /ip4/127.0.0.1/tcp/5001)"),
94
},
95
}
core/commands/stat.go
+1
-1
@@ -72,7 +72,7 @@ Example:
72
Options: []cmdkit.Option{
73
cmdkit.StringOption("peer", "p", "Specify a peer to print bandwidth for."),
74
cmdkit.StringOption("proto", "t", "Specify a protocol to print bandwidth for."),
75
- cmdkit.BoolOption("poll", "Print bandwidth at an interval.").Default(false),
75
+ cmdkit.BoolOption("poll", "Print bandwidth at an interval."),
76
cmdkit.StringOption("interval", "i", `Time interval to wait between updating output, if 'poll' is true.
77
78
This accepts durations such as "300s", "1.5h" or "2h45m". Valid time units are:
core/commands/swarm.go
+1
-1
@@ -279,7 +279,7 @@ var swarmAddrsLocalCmd = &cmds.Command{
279
`,
280
},
281
Options: []cmdkit.Option{
282
- cmdkit.BoolOption("id", "Show peer ID in addresses.").Default(false),
282
+ cmdkit.BoolOption("id", "Show peer ID in addresses."),
283
},
284
Run: func(req cmds.Request, res cmds.Response) {
285
iCtx := req.InvocContext()
core/commands/version.go
+4
-4
@@ -28,10 +28,10 @@ var VersionCmd = &cmds.Command{
28
},
29
30
Options: []cmdkit.Option{
31
- cmdkit.BoolOption("number", "n", "Only show the version number.").Default(false),
32
- cmdkit.BoolOption("commit", "Show the commit hash.").Default(false),
33
- cmdkit.BoolOption("repo", "Show repo version.").Default(false),
34
- cmdkit.BoolOption("all", "Show all version information").Default(false),
31
+ cmdkit.BoolOption("number", "n", "Only show the version number."),
32
+ cmdkit.BoolOption("commit", "Show the commit hash."),
33
+ cmdkit.BoolOption("repo", "Show repo version."),
34
+ cmdkit.BoolOption("all", "Show all version information"),
35
},
36
Run: func(req cmds.Request, res cmds.Response) {
37
res.SetOutput(&VersionOutput{