提交 f52050de 作者: Richard Littauer

Added Default false to all remaining options

Specifically, to `repo`, `resolve`, `swarm`, and `version`. Part of #2484.

License: MIT
Signed-off-by: 's avatarRichard Littauer <richard.littauer@gmail.com>
上级 a2bcec40
...@@ -38,7 +38,7 @@ order to reclaim hard disk space. ...@@ -38,7 +38,7 @@ order to reclaim hard disk space.
`, `,
}, },
Options: []cmds.Option{ Options: []cmds.Option{
cmds.BoolOption("quiet", "q", "Write minimal output."), cmds.BoolOption("quiet", "q", "Write minimal output.").Default(false),
}, },
Run: func(req cmds.Request, res cmds.Response) { Run: func(req cmds.Request, res cmds.Response) {
n, err := req.InvocContext().GetNode() n, err := req.InvocContext().GetNode()
...@@ -127,7 +127,7 @@ RepoSize int Size in bytes that the repo is currently taking. ...@@ -127,7 +127,7 @@ RepoSize int Size in bytes that the repo is currently taking.
res.SetOutput(stat) res.SetOutput(stat)
}, },
Options: []cmds.Option{ Options: []cmds.Option{
cmds.BoolOption("human", "Output RepoSize in MiB."), cmds.BoolOption("human", "Output RepoSize in MiB.").Default(false),
}, },
Type: corerepo.Stat{}, Type: corerepo.Stat{},
Marshalers: cmds.MarshalerMap{ Marshalers: cmds.MarshalerMap{
......
...@@ -59,7 +59,7 @@ Resolve the value of an IPFS DAG path: ...@@ -59,7 +59,7 @@ Resolve the value of an IPFS DAG path:
cmds.StringArg("name", true, false, "The name to resolve.").EnableStdin(), cmds.StringArg("name", true, false, "The name to resolve.").EnableStdin(),
}, },
Options: []cmds.Option{ Options: []cmds.Option{
cmds.BoolOption("recursive", "r", "Resolve until the result is an IPFS name. Default: false."), cmds.BoolOption("recursive", "r", "Resolve until the result is an IPFS name.").Default(false),
}, },
Run: func(req cmds.Request, res cmds.Response) { Run: func(req cmds.Request, res cmds.Response) {
......
...@@ -152,7 +152,7 @@ var swarmAddrsLocalCmd = &cmds.Command{ ...@@ -152,7 +152,7 @@ var swarmAddrsLocalCmd = &cmds.Command{
`, `,
}, },
Options: []cmds.Option{ Options: []cmds.Option{
cmds.BoolOption("id", "Show peer ID in addresses."), cmds.BoolOption("id", "Show peer ID in addresses.").Default(false),
}, },
Run: func(req cmds.Request, res cmds.Response) { Run: func(req cmds.Request, res cmds.Response) {
......
...@@ -23,9 +23,9 @@ var VersionCmd = &cmds.Command{ ...@@ -23,9 +23,9 @@ var VersionCmd = &cmds.Command{
}, },
Options: []cmds.Option{ Options: []cmds.Option{
cmds.BoolOption("number", "n", "Only show the version number."), cmds.BoolOption("number", "n", "Only show the version number.").Default(false),
cmds.BoolOption("commit", "Show the commit hash."), cmds.BoolOption("commit", "Show the commit hash.").Default(false),
cmds.BoolOption("repo", "Show repo version."), cmds.BoolOption("repo", "Show repo version.").Default(false),
}, },
Run: func(req cmds.Request, res cmds.Response) { Run: func(req cmds.Request, res cmds.Response) {
res.SetOutput(&VersionOutput{ res.SetOutput(&VersionOutput{
...@@ -47,20 +47,20 @@ var VersionCmd = &cmds.Command{ ...@@ -47,20 +47,20 @@ var VersionCmd = &cmds.Command{
return strings.NewReader(v.Repo + "\n"), nil return strings.NewReader(v.Repo + "\n"), nil
} }
commit, found, err := res.Request().Option("commit").Bool() commit, _, err := res.Request().Option("commit").Bool()
commitTxt := "" commitTxt := ""
if err != nil { if err != nil {
return nil, err return nil, err
} }
if found && commit { if commit {
commitTxt = "-" + v.Commit commitTxt = "-" + v.Commit
} }
number, found, err := res.Request().Option("number").Bool() number, _, err := res.Request().Option("number").Bool()
if err != nil { if err != nil {
return nil, err return nil, err
} }
if found && number { if number {
return strings.NewReader(fmt.Sprintln(v.Version + commitTxt)), nil return strings.NewReader(fmt.Sprintln(v.Version + commitTxt)), nil
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论