1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-09-10 05:52:20 +08:00

Merge pull request #613 from jbenet/progress-bars

Progress Bars
This commit is contained in:
Juan Batiz-Benet
2015-01-23 22:20:34 -08:00
53 changed files with 1591 additions and 323 deletions

View File

@ -39,22 +39,29 @@ var initCmd = &cmds.Command{
// name of the file?
// TODO cmds.StringOption("event-logs", "l", "Location for machine-readable event logs"),
},
Run: func(req cmds.Request) (interface{}, error) {
Run: func(req cmds.Request, res cmds.Response) {
force, _, err := req.Option("f").Bool() // if !found, it's okay force == false
if err != nil {
return nil, err
res.SetError(err, cmds.ErrNormal)
return
}
nBitsForKeypair, bitsOptFound, err := req.Option("b").Int()
if err != nil {
return nil, err
res.SetError(err, cmds.ErrNormal)
return
}
if !bitsOptFound {
nBitsForKeypair = nBitsForKeypairDefault
}
return doInit(req.Context().ConfigRoot, force, nBitsForKeypair)
output, err := doInit(req.Context().ConfigRoot, force, nBitsForKeypair)
if err != nil {
res.SetError(err, cmds.ErrNormal)
return
}
res.SetOutput(output)
},
}