commands/files: can't get flush option
License: MIT Signed-off-by: Overbool <overbool.xu@gmail.com>
Overbool committed
Oct 27, 2018 at 13:45 UTC
546d3bed5a81916419d2dfc9884d70882ebabea1
1 file changed
+7
-8
core/commands/files.go
+7
-8
@@ -49,7 +49,7 @@ operations.
49
`,
50
},
51
Options: []cmdkit.Option{
52
- cmdkit.BoolOption("f", "flush", "Flush target and ancestors after write.").WithDefault(true),
52
+ cmdkit.BoolOption(filesFlushOptionName, "f", "Flush target and ancestors after write.").WithDefault(true),
53
},
54
Subcommands: map[string]*cmds.Command{
55
"read": filesReadCmd,
@@ -313,7 +313,7 @@ var filesCpCmd = &cmds.Command{
313
return err
314
}
315
316
- flush, _ := req.Options["flush"].(bool)
316
+ flush, _ := req.Options[filesFlushOptionName].(bool)
317
318
src, err := checkPath(req.Arguments[0])
319
if err != nil {
@@ -448,13 +448,12 @@ Examples:
448
})
449
}
450
return res.Emit(&filesLsOutput{output})
451
- } else {
452
- listing, err := fsn.List(req.Context)
453
- if err != nil {
454
- return err
455
- }
456
- return res.Emit(&filesLsOutput{listing})
451
}
452
+ listing, err := fsn.List(req.Context)
453
+ if err != nil {
454
+ return err
455
+ }
456
+ return res.Emit(&filesLsOutput{listing})
457
case *mfs.File:
458
_, name := gopath.Split(path)
459
out := &filesLsOutput{[]mfs.NodeListing{{Name: name}}}