Skip to content

Commit

Permalink
Merge pull request #4042 from asymmetric/fix/default-false
Browse files Browse the repository at this point in the history
remove all instances of `Default(false)`
  • Loading branch information
whyrusleeping authored Nov 21, 2017
2 parents a62eb62 + 57f544a commit 218b299
Show file tree
Hide file tree
Showing 24 changed files with 55 additions and 55 deletions.
14 changes: 7 additions & 7 deletions cmd/ipfs/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,17 +144,17 @@ Headers.
},

Options: []cmdkit.Option{
cmdkit.BoolOption(initOptionKwd, "Initialize ipfs with default settings if not already initialized").Default(false),
cmdkit.BoolOption(initOptionKwd, "Initialize ipfs with default settings if not already initialized"),
cmdkit.StringOption(routingOptionKwd, "Overrides the routing option").Default("dht"),
cmdkit.BoolOption(mountKwd, "Mounts IPFS to the filesystem").Default(false),
cmdkit.BoolOption(writableKwd, "Enable writing objects (with POST, PUT and DELETE)").Default(false),
cmdkit.BoolOption(mountKwd, "Mounts IPFS to the filesystem"),
cmdkit.BoolOption(writableKwd, "Enable writing objects (with POST, PUT and DELETE)"),
cmdkit.StringOption(ipfsMountKwd, "Path to the mountpoint for IPFS (if using --mount). Defaults to config setting."),
cmdkit.StringOption(ipnsMountKwd, "Path to the mountpoint for IPNS (if using --mount). Defaults to config setting."),
cmdkit.BoolOption(unrestrictedApiAccessKwd, "Allow API access to unlisted hashes").Default(false),
cmdkit.BoolOption(unencryptTransportKwd, "Disable transport encryption (for debugging protocols)").Default(false),
cmdkit.BoolOption(enableGCKwd, "Enable automatic periodic repo garbage collection").Default(false),
cmdkit.BoolOption(unrestrictedApiAccessKwd, "Allow API access to unlisted hashes"),
cmdkit.BoolOption(unencryptTransportKwd, "Disable transport encryption (for debugging protocols)"),
cmdkit.BoolOption(enableGCKwd, "Enable automatic periodic repo garbage collection"),
cmdkit.BoolOption(adjustFDLimitKwd, "Check and raise file descriptor limits if needed").Default(true),
cmdkit.BoolOption(offlineKwd, "Run offline. Do not connect to the rest of the network but provide local API.").Default(false),
cmdkit.BoolOption(offlineKwd, "Run offline. Do not connect to the rest of the network but provide local API."),
cmdkit.BoolOption(migrateKwd, "If true, assume yes at the migrate prompt. If false, assume no."),
cmdkit.BoolOption(enableFloodSubKwd, "Instantiate the ipfs daemon with the experimental pubsub feature enabled."),
cmdkit.BoolOption(enableMultiplexKwd, "Add the experimental 'go-multiplex' stream muxer to libp2p on construction.").Default(true),
Expand Down
2 changes: 1 addition & 1 deletion cmd/ipfs/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ environment variable:
},
Options: []cmdkit.Option{
cmdkit.IntOption("bits", "b", "Number of bits to use in the generated RSA private key.").Default(nBitsForKeypairDefault),
cmdkit.BoolOption("empty-repo", "e", "Don't add and pin help files to the local storage.").Default(false),
cmdkit.BoolOption("empty-repo", "e", "Don't add and pin help files to the local storage."),
cmdkit.StringOption("profile", "p", "Apply profile settings to config. Multiple profiles can be separated by ','"),

// TODO need to decide whether to expose the override as a file or a
Expand Down
2 changes: 1 addition & 1 deletion core/commands/active.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Lists running and recently run commands.
res.SetOutput(req.InvocContext().ReqLog.Report())
},
Options: []cmdkit.Option{
cmdkit.BoolOption("verbose", "v", "Print extra information.").Default(false),
cmdkit.BoolOption("verbose", "v", "Print extra information."),
},
Subcommands: map[string]*cmds.Command{
"clear": clearInactiveCmd,
Expand Down
4 changes: 2 additions & 2 deletions core/commands/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,8 @@ It takes a list of base58 encoded multihashs to remove.
cmdkit.StringArg("hash", true, true, "Bash58 encoded multihash of block(s) to remove."),
},
Options: []cmdkit.Option{
cmdkit.BoolOption("force", "f", "Ignore nonexistent blocks.").Default(false),
cmdkit.BoolOption("quiet", "q", "Write minimal output.").Default(false),
cmdkit.BoolOption("force", "f", "Ignore nonexistent blocks."),
cmdkit.BoolOption("quiet", "q", "Write minimal output."),
},
Run: func(req cmds.Request, res cmds.ResponseEmitter) {
n, err := req.InvocContext().GetNode()
Expand Down
2 changes: 1 addition & 1 deletion core/commands/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func CommandsCmd(root *cmds.Command) *cmds.Command {
ShortDescription: `Lists all available commands (and subcommands) and exits.`,
},
Options: []cmdkit.Option{
cmdkit.BoolOption(flagsOptionName, "f", "Show command flags").Default(false),
cmdkit.BoolOption(flagsOptionName, "f", "Show command flags"),
},
Run: func(req cmds.Request, res cmds.ResponseEmitter) {
rootCmd := cmd2outputCmd("ipfs", root)
Expand Down
4 changes: 2 additions & 2 deletions core/commands/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ Set the value of the 'Datastore.Path' key:
cmdkit.StringArg("value", false, false, "The value to set the config entry to."),
},
Options: []cmdkit.Option{
cmdkit.BoolOption("bool", "Set a boolean value.").Default(false),
cmdkit.BoolOption("json", "Parse stringified JSON.").Default(false),
cmdkit.BoolOption("bool", "Set a boolean value."),
cmdkit.BoolOption("json", "Parse stringified JSON."),
},
Run: func(req cmds.Request, res cmds.Response) {
args := req.Arguments()
Expand Down
2 changes: 1 addition & 1 deletion core/commands/dag/dag.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ into an object of the specified format.
Options: []cmdkit.Option{
cmdkit.StringOption("format", "f", "Format that the object will be added as.").Default("cbor"),
cmdkit.StringOption("input-enc", "Format that the input object will be.").Default("json"),
cmdkit.BoolOption("pin", "Pin this object when adding.").Default(false),
cmdkit.BoolOption("pin", "Pin this object when adding."),
cmdkit.StringOption("hash", "Hash function to use").Default(""),
},
Run: func(req cmds.Request, res cmds.Response) {
Expand Down
14 changes: 7 additions & 7 deletions core/commands/dht.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ var queryDhtCmd = &cmds.Command{
cmdkit.StringArg("peerID", true, true, "The peerID to run the query against."),
},
Options: []cmdkit.Option{
cmdkit.BoolOption("verbose", "v", "Print extra information.").Default(false),
cmdkit.BoolOption("verbose", "v", "Print extra information."),
},
Run: func(req cmds.Request, res cmds.Response) {
n, err := req.InvocContext().GetNode()
Expand Down Expand Up @@ -139,7 +139,7 @@ var findProvidersDhtCmd = &cmds.Command{
cmdkit.StringArg("key", true, true, "The key to find providers for."),
},
Options: []cmdkit.Option{
cmdkit.BoolOption("verbose", "v", "Print extra information.").Default(false),
cmdkit.BoolOption("verbose", "v", "Print extra information."),
cmdkit.IntOption("num-providers", "n", "The number of providers to find.").Default(20),
},
Run: func(req cmds.Request, res cmds.Response) {
Expand Down Expand Up @@ -248,8 +248,8 @@ var provideRefDhtCmd = &cmds.Command{
cmdkit.StringArg("key", true, true, "The key[s] to send provide records for.").EnableStdin(),
},
Options: []cmdkit.Option{
cmdkit.BoolOption("verbose", "v", "Print extra information.").Default(false),
cmdkit.BoolOption("recursive", "r", "Recursively provide entire graph.").Default(false),
cmdkit.BoolOption("verbose", "v", "Print extra information."),
cmdkit.BoolOption("recursive", "r", "Recursively provide entire graph."),
},
Run: func(req cmds.Request, res cmds.Response) {
n, err := req.InvocContext().GetNode()
Expand Down Expand Up @@ -397,7 +397,7 @@ var findPeerDhtCmd = &cmds.Command{
cmdkit.StringArg("peerID", true, true, "The ID of the peer to search for."),
},
Options: []cmdkit.Option{
cmdkit.BoolOption("verbose", "v", "Print extra information.").Default(false),
cmdkit.BoolOption("verbose", "v", "Print extra information."),
},
Run: func(req cmds.Request, res cmds.Response) {
n, err := req.InvocContext().GetNode()
Expand Down Expand Up @@ -499,7 +499,7 @@ Different key types can specify other 'best' rules.
cmdkit.StringArg("key", true, true, "The key to find a value for."),
},
Options: []cmdkit.Option{
cmdkit.BoolOption("verbose", "v", "Print extra information.").Default(false),
cmdkit.BoolOption("verbose", "v", "Print extra information."),
},
Run: func(req cmds.Request, res cmds.Response) {
n, err := req.InvocContext().GetNode()
Expand Down Expand Up @@ -611,7 +611,7 @@ NOTE: A value may not exceed 2048 bytes.
cmdkit.StringArg("value", true, false, "The value to store.").EnableStdin(),
},
Options: []cmdkit.Option{
cmdkit.BoolOption("verbose", "v", "Print extra information.").Default(false),
cmdkit.BoolOption("verbose", "v", "Print extra information."),
},
Run: func(req cmds.Request, res cmds.Response) {
n, err := req.InvocContext().GetNode()
Expand Down
2 changes: 1 addition & 1 deletion core/commands/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ The resolver can recursively resolve:
cmdkit.StringArg("domain-name", true, false, "The domain-name name to resolve.").EnableStdin(),
},
Options: []cmdkit.Option{
cmdkit.BoolOption("recursive", "r", "Resolve until the result is not a DNS link.").Default(false),
cmdkit.BoolOption("recursive", "r", "Resolve until the result is not a DNS link."),
},
Run: func(req cmds.Request, res cmds.Response) {

Expand Down
4 changes: 2 additions & 2 deletions core/commands/files/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ Size: <size>
CumulativeSize: <cumulsize>
ChildBlocks: <childs>
Type: <type>`),
cmdkit.BoolOption("hash", "Print only hash. Implies '--format=<hash>'. Conflicts with other format options.").Default(false),
cmdkit.BoolOption("size", "Print only size. Implies '--format=<cumulsize>'. Conflicts with other format options.").Default(false),
cmdkit.BoolOption("hash", "Print only hash. Implies '--format=<hash>'. Conflicts with other format options."),
cmdkit.BoolOption("size", "Print only size. Implies '--format=<cumulsize>'. Conflicts with other format options."),
},
Run: func(req cmds.Request, res cmds.Response) {

Expand Down
4 changes: 2 additions & 2 deletions core/commands/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ may also specify the level of compression by specifying '-l=<1-9>'.
},
Options: []cmdkit.Option{
cmdkit.StringOption("output", "o", "The path where the output should be stored."),
cmdkit.BoolOption("archive", "a", "Output a TAR archive.").Default(false),
cmdkit.BoolOption("compress", "C", "Compress the output with GZIP compression.").Default(false),
cmdkit.BoolOption("archive", "a", "Output a TAR archive."),
cmdkit.BoolOption("compress", "C", "Compress the output with GZIP compression."),
cmdkit.IntOption("compression-level", "l", "The level of compression (1-9).").Default(-1),
},
PreRun: func(req cmds.Request) error {
Expand Down
4 changes: 2 additions & 2 deletions core/commands/ipns.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ Resolve the value of a dnslink:
cmdkit.StringArg("name", false, false, "The IPNS name to resolve. Defaults to your node's peerID."),
},
Options: []cmdkit.Option{
cmdkit.BoolOption("recursive", "r", "Resolve until the result is not an IPNS name.").Default(false),
cmdkit.BoolOption("nocache", "n", "Do not use cached entries.").Default(false),
cmdkit.BoolOption("recursive", "r", "Resolve until the result is not an IPNS name."),
cmdkit.BoolOption("nocache", "n", "Do not use cached entries."),
},
Run: func(req cmds.Request, res cmds.Response) {

Expand Down
2 changes: 1 addition & 1 deletion core/commands/ls.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ The JSON output contains type information.
cmdkit.StringArg("ipfs-path", true, true, "The path to the IPFS object(s) to list links from.").EnableStdin(),
},
Options: []cmdkit.Option{
cmdkit.BoolOption("headers", "v", "Print table headers (Hash, Size, Name).").Default(false),
cmdkit.BoolOption("headers", "v", "Print table headers (Hash, Size, Name)."),
cmdkit.BoolOption("resolve-type", "Resolve linked objects to find out their types.").Default(true),
},
Run: func(req cmds.Request, res cmds.Response) {
Expand Down
4 changes: 2 additions & 2 deletions core/commands/object/object.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ multihash.
cmdkit.StringArg("key", true, false, "Key of the object to retrieve, in base58-encoded multihash format.").EnableStdin(),
},
Options: []cmdkit.Option{
cmdkit.BoolOption("headers", "v", "Print table headers (Hash, Size, Name).").Default(false),
cmdkit.BoolOption("headers", "v", "Print table headers (Hash, Size, Name)."),
},
Run: func(req cmds.Request, res cmds.Response) {
n, err := req.InvocContext().GetNode()
Expand Down Expand Up @@ -384,7 +384,7 @@ And then run:
Options: []cmdkit.Option{
cmdkit.StringOption("inputenc", "Encoding type of input data. One of: {\"protobuf\", \"json\"}.").Default("json"),
cmdkit.StringOption("datafieldenc", "Encoding type of the data field, either \"text\" or \"base64\".").Default("text"),
cmdkit.BoolOption("pin", "Pin this object when adding.").Default(false),
cmdkit.BoolOption("pin", "Pin this object when adding."),
},
Run: func(req cmds.Request, res cmds.Response) {
n, err := req.InvocContext().GetNode()
Expand Down
2 changes: 1 addition & 1 deletion core/commands/object/patch.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ to a file containing 'bar', and returns the hash of the new object.
cmdkit.StringArg("ref", true, false, "IPFS object to add link to."),
},
Options: []cmdkit.Option{
cmdkit.BoolOption("create", "p", "Create intermediary nodes.").Default(false),
cmdkit.BoolOption("create", "p", "Create intermediary nodes."),
},
Run: func(req cmds.Request, res cmds.Response) {
nd, err := req.InvocContext().GetNode()
Expand Down
8 changes: 4 additions & 4 deletions core/commands/p2p.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ var p2pListenerLsCmd = &cmds.Command{
Tagline: "List active p2p listeners.",
},
Options: []cmdkit.Option{
cmdkit.BoolOption("headers", "v", "Print table headers (HandlerID, Protocol, Local, Remote).").Default(false),
cmdkit.BoolOption("headers", "v", "Print table headers (HandlerID, Protocol, Local, Remote)."),
},
Run: func(req cmds.Request, res cmds.Response) {

Expand Down Expand Up @@ -143,7 +143,7 @@ var p2pStreamLsCmd = &cmds.Command{
Tagline: "List active p2p streams.",
},
Options: []cmdkit.Option{
cmdkit.BoolOption("headers", "v", "Print table headers (HagndlerID, Protocol, Local, Remote).").Default(false),
cmdkit.BoolOption("headers", "v", "Print table headers (HagndlerID, Protocol, Local, Remote)."),
},
Run: func(req cmds.Request, res cmds.Response) {
n, err := getNode(req)
Expand Down Expand Up @@ -307,7 +307,7 @@ var p2pListenerCloseCmd = &cmds.Command{
cmdkit.StringArg("Protocol", false, false, "P2P listener protocol"),
},
Options: []cmdkit.Option{
cmdkit.BoolOption("all", "a", "Close all listeners.").Default(false),
cmdkit.BoolOption("all", "a", "Close all listeners."),
},
Run: func(req cmds.Request, res cmds.Response) {
res.SetOutput(nil)
Expand Down Expand Up @@ -350,7 +350,7 @@ var p2pStreamCloseCmd = &cmds.Command{
cmdkit.StringArg("HandlerID", false, false, "Stream HandlerID"),
},
Options: []cmdkit.Option{
cmdkit.BoolOption("all", "a", "Close all streams.").Default(false),
cmdkit.BoolOption("all", "a", "Close all streams."),
},
Run: func(req cmds.Request, res cmds.Response) {
res.SetOutput(nil)
Expand Down
2 changes: 1 addition & 1 deletion core/commands/pin.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ Example:
},
Options: []cmdkit.Option{
cmdkit.StringOption("type", "t", "The type of pinned keys to list. Can be \"direct\", \"indirect\", \"recursive\", or \"all\".").Default("all"),
cmdkit.BoolOption("quiet", "q", "Write just hashes of objects.").Default(false),
cmdkit.BoolOption("quiet", "q", "Write just hashes of objects."),
},
Run: func(req cmds.Request, res cmds.Response) {
n, err := req.InvocContext().GetNode()
Expand Down
6 changes: 3 additions & 3 deletions core/commands/refs.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ NOTE: List all references recursively by using the flag '-r'.
},
Options: []cmdkit.Option{
cmdkit.StringOption("format", "Emit edges with given format. Available tokens: <src> <dst> <linkname>.").Default("<dst>"),
cmdkit.BoolOption("edges", "e", "Emit edge format: `<from> -> <to>`.").Default(false),
cmdkit.BoolOption("unique", "u", "Omit duplicate refs from output.").Default(false),
cmdkit.BoolOption("recursive", "r", "Recursively list links of child nodes.").Default(false),
cmdkit.BoolOption("edges", "e", "Emit edge format: `<from> -> <to>`."),
cmdkit.BoolOption("unique", "u", "Omit duplicate refs from output."),
cmdkit.BoolOption("recursive", "r", "Recursively list links of child nodes."),
},
Run: func(req cmds.Request, res cmds.Response) {
ctx := req.Context()
Expand Down
6 changes: 3 additions & 3 deletions core/commands/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ order to reclaim hard disk space.
`,
},
Options: []cmdkit.Option{
cmdkit.BoolOption("stream-errors", "Stream errors.").Default(false),
cmdkit.BoolOption("quiet", "q", "Write minimal output.").Default(false),
cmdkit.BoolOption("stream-errors", "Stream errors."),
cmdkit.BoolOption("quiet", "q", "Write minimal output."),
},
Run: func(req oldcmds.Request, res oldcmds.Response) {
n, err := req.InvocContext().GetNode()
Expand Down Expand Up @@ -165,7 +165,7 @@ Version string The repo version.
cmds.EmitOnce(res, stat)
},
Options: []cmdkit.Option{
cmdkit.BoolOption("human", "Output RepoSize in MiB.").Default(false),
cmdkit.BoolOption("human", "Output RepoSize in MiB."),
},
Type: corerepo.Stat{},
Encoders: cmds.EncoderMap{
Expand Down
2 changes: 1 addition & 1 deletion core/commands/resolve.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Resolve the value of an IPFS DAG path:
cmdkit.StringArg("name", true, false, "The name to resolve.").EnableStdin(),
},
Options: []cmdkit.Option{
cmdkit.BoolOption("recursive", "r", "Resolve until the result is an IPFS name.").Default(false),
cmdkit.BoolOption("recursive", "r", "Resolve until the result is an IPFS name."),
},
Run: func(req cmds.Request, res cmds.Response) {

Expand Down
8 changes: 4 additions & 4 deletions core/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ The CLI will exit with one of the following values:
},
Options: []cmdkit.Option{
cmdkit.StringOption("config", "c", "Path to the configuration file to use."),
cmdkit.BoolOption("debug", "D", "Operate in debug mode.").Default(false),
cmdkit.BoolOption("help", "Show the full command help text.").Default(false),
cmdkit.BoolOption("h", "Show a short version of the command help text.").Default(false),
cmdkit.BoolOption("local", "L", "Run the command locally, instead of using the daemon.").Default(false),
cmdkit.BoolOption("debug", "D", "Operate in debug mode."),
cmdkit.BoolOption("help", "Show the full command help text."),
cmdkit.BoolOption("h", "Show a short version of the command help text."),
cmdkit.BoolOption("local", "L", "Run the command locally, instead of using the daemon."),
cmdkit.StringOption(ApiOption, "Use a specific API instance (defaults to /ip4/127.0.0.1/tcp/5001)"),
},
}
Expand Down
2 changes: 1 addition & 1 deletion core/commands/stat.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Example:
Options: []cmdkit.Option{
cmdkit.StringOption("peer", "p", "Specify a peer to print bandwidth for."),
cmdkit.StringOption("proto", "t", "Specify a protocol to print bandwidth for."),
cmdkit.BoolOption("poll", "Print bandwidth at an interval.").Default(false),
cmdkit.BoolOption("poll", "Print bandwidth at an interval."),
cmdkit.StringOption("interval", "i", `Time interval to wait between updating output, if 'poll' is true.
This accepts durations such as "300s", "1.5h" or "2h45m". Valid time units are:
Expand Down
2 changes: 1 addition & 1 deletion core/commands/swarm.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ var swarmAddrsLocalCmd = &cmds.Command{
`,
},
Options: []cmdkit.Option{
cmdkit.BoolOption("id", "Show peer ID in addresses.").Default(false),
cmdkit.BoolOption("id", "Show peer ID in addresses."),
},
Run: func(req cmds.Request, res cmds.Response) {
iCtx := req.InvocContext()
Expand Down
8 changes: 4 additions & 4 deletions core/commands/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ var VersionCmd = &cmds.Command{
},

Options: []cmdkit.Option{
cmdkit.BoolOption("number", "n", "Only show the version number.").Default(false),
cmdkit.BoolOption("commit", "Show the commit hash.").Default(false),
cmdkit.BoolOption("repo", "Show repo version.").Default(false),
cmdkit.BoolOption("all", "Show all version information").Default(false),
cmdkit.BoolOption("number", "n", "Only show the version number."),
cmdkit.BoolOption("commit", "Show the commit hash."),
cmdkit.BoolOption("repo", "Show repo version."),
cmdkit.BoolOption("all", "Show all version information"),
},
Run: func(req cmds.Request, res cmds.Response) {
res.SetOutput(&VersionOutput{
Expand Down

0 comments on commit 218b299

Please sign in to comment.