@cryptotaxi247 / kubo / commits / 1a6784e07

Add default True to files flush

License: MIT Signed-off-by: Richard Littauer <richard.littauer@gmail.com>

Richard Littauer committed Sep 1, 2016 at 11:47 UTC 1a6784e070ae32a36a0b124c78bbfed66c4fd274
1 file changed +4 -13
core/commands/files/files.go
+4 -13
@@ -40,7 +40,7 @@ operations.
40 `,
41 },
42 Options: []cmds.Option{
43 - cmds.BoolOption("flush", "f", "Flush target and ancestors after write. Default: true."),
43 + cmds.BoolOption("f", "flush", "Flush target and ancestors after write.").Default(true),
44 },
45 Subcommands: map[string]*cmds.Command{
46 "read": FilesReadCmd,
@@ -207,10 +207,7 @@ var FilesCpCmd = &cmds.Command{
207 return
208 }
209
210 - flush, found, _ := req.Option("flush").Bool()
211 - if !found {
212 - flush = true
213 - }
210 + flush, _, _ := req.Option("flush").Bool()
211
212 src, err := checkPath(req.Arguments()[0])
213 if err != nil {
@@ -585,10 +582,7 @@ stat' on the file or any of its ancestors.
582
583 create, _, _ := req.Option("create").Bool()
584 trunc, _, _ := req.Option("truncate").Bool()
588 - flush, fset, _ := req.Option("flush").Bool()
589 - if !fset {
590 - flush = true
591 - }
585 + flush, _, _ := req.Option("flush").Bool()
586
587 nd, err := req.InvocContext().GetNode()
588 if err != nil {
@@ -700,10 +694,7 @@ Examples:
694 return
695 }
696
703 - flush, found, _ := req.Option("flush").Bool()
704 - if !found {
705 - flush = true
706 - }
697 + flush, _, _ := req.Option("flush").Bool()
698
699 err = mfs.Mkdir(n.FilesRoot, dirtomake, dashp, flush)
700 if err != nil {