提交 013d98a3 作者: Brian Tiger Chow 提交者: Juan Batiz-Benet

fix(2/init, 2/add) fix optionvalue signature

上级 3493e33e
...@@ -27,25 +27,25 @@ var initCmd = &cmds.Command{ ...@@ -27,25 +27,25 @@ var initCmd = &cmds.Command{
}, },
Run: func(req cmds.Request) (interface{}, error) { Run: func(req cmds.Request) (interface{}, error) {
dspath, err := req.Option("d").String() dspathOverride, _, err := req.Option("d").String() // if !found it's okay. Let == ""
if err != nil { if err != nil {
return nil, err return nil, err
} }
force, err := req.Option("f").Bool() force, _, err := req.Option("f").Bool() // if !found, it's okay force == false
if err != nil { if err != nil {
return nil, err return nil, err
} }
nBitsForKeypair, err := req.Option("b").Int() nBitsForKeypair, bitsOptFound, err := req.Option("b").Int()
if err != nil { if err != nil {
return nil, err return nil, err
} }
if !req.Option("b").Found() { if !bitsOptFound {
nBitsForKeypair = 4096 nBitsForKeypair = 4096
} }
return nil, doInit(req.Context().ConfigRoot, dspath, force, nBitsForKeypair) return nil, doInit(req.Context().ConfigRoot, dspathOverride, force, nBitsForKeypair)
}, },
} }
......
...@@ -45,7 +45,7 @@ remains to be implemented. ...@@ -45,7 +45,7 @@ remains to be implemented.
added := &AddOutput{} added := &AddOutput{}
n := req.Context().Node n := req.Context().Node
recursive, err := req.Option("r").Bool() recursive, _, err := req.Option("r").Bool()
if err != nil { if err != nil {
return nil, err return nil, err
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论