@cryptotaxi247 / kubo / commits / 013d98a35

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

Brian Tiger Chow committed Nov 12, 2014 at 00:40 UTC 013d98a35af1269612256120bc2212f2ee39bdac
2 files changed +6 -6
cmd/ipfs2/init.go
+5 -5
@@ -27,25 +27,25 @@ var initCmd = &cmds.Command{
27 },
28 Run: func(req cmds.Request) (interface{}, error) {
29
30 - dspath, err := req.Option("d").String()
30 + dspathOverride, _, err := req.Option("d").String() // if !found it's okay. Let == ""
31 if err != nil {
32 return nil, err
33 }
34
35 - force, err := req.Option("f").Bool()
35 + force, _, err := req.Option("f").Bool() // if !found, it's okay force == false
36 if err != nil {
37 return nil, err
38 }
39
40 - nBitsForKeypair, err := req.Option("b").Int()
40 + nBitsForKeypair, bitsOptFound, err := req.Option("b").Int()
41 if err != nil {
42 return nil, err
43 }
44 - if !req.Option("b").Found() {
44 + if !bitsOptFound {
45 nBitsForKeypair = 4096
46 }
47
48 - return nil, doInit(req.Context().ConfigRoot, dspath, force, nBitsForKeypair)
48 + return nil, doInit(req.Context().ConfigRoot, dspathOverride, force, nBitsForKeypair)
49 },
50 }
51
core/commands2/add.go
+1 -1
@@ -45,7 +45,7 @@ remains to be implemented.
45 added := &AddOutput{}
46 n := req.Context().Node
47
48 - recursive, err := req.Option("r").Bool()
48 + recursive, _, err := req.Option("r").Bool()
49 if err != nil {
50 return nil, err
51 }