@cryptotaxi247 / kubo / commits / 62cd07813

Copy edited files command file

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

Richard Littauer committed Feb 19, 2016 at 10:09 UTC 62cd07813b3dae3826e24c370b725e353dced08f
1 file changed +16 -16
core/commands/files/files.go
+16 -16
@@ -26,11 +26,11 @@ var FilesCmd = &cmds.Command{
26 Helptext: cmds.HelpText{
27 Tagline: "Manipulate unixfs files.",
28 ShortDescription: `
29 -Files is an API for manipulating ipfs objects as if they were a unix filesystem.
29 +Files is an API for manipulating IPFS objects as if they were a unix filesystem.
30
31 Note:
32 Most of the subcommands of 'ipfs files' accept the '--flush' flag. It defaults to
33 -true. Use caution when setting this flag to false, It will improve performance
33 +true. Use caution when setting this flag to false. It will improve performance
34 for large numbers of file operations, but it does so at the cost of consistency
35 guarantees. If the daemon is unexpectedly killed before running 'ipfs files flush'
36 on the files in question, then data may be lost. This also applies to running
@@ -38,7 +38,7 @@ on the files in question, then data may be lost. This also applies to running
38 `,
39 },
40 Options: []cmds.Option{
41 - cmds.BoolOption("f", "flush", "Flush target and ancestors after write (default: true)."),
41 + cmds.BoolOption("f", "flush", "Flush target and ancestors after write. Default: true."),
42 },
43 Subcommands: map[string]*cmds.Command{
44 "read": FilesReadCmd,
@@ -131,7 +131,7 @@ func statNode(ds dag.DAGService, fsn mfs.FSNode) (*Object, error) {
131 case mfs.TFile:
132 ndtype = "file"
133 default:
134 - return nil, fmt.Errorf("unrecognized node type: %s", fsn.Type())
134 + return nil, fmt.Errorf("Unrecognized node type: %s", fsn.Type())
135 }
136
137 return &Object{
@@ -364,7 +364,7 @@ Examples:
364
365 fi, ok := fsn.(*mfs.File)
366 if !ok {
367 - res.SetError(fmt.Errorf("%s was not a file", path), cmds.ErrNormal)
367 + res.SetError(fmt.Errorf("%s was not a file.", path), cmds.ErrNormal)
368 return
369 }
370
@@ -382,7 +382,7 @@ Examples:
382 return
383 }
384 if offset < 0 {
385 - res.SetError(fmt.Errorf("cannot specify negative offset"), cmds.ErrNormal)
385 + res.SetError(fmt.Errorf("Cannot specify negative offset."), cmds.ErrNormal)
386 return
387 }
388
@@ -393,7 +393,7 @@ Examples:
393 }
394
395 if int64(offset) > filen {
396 - res.SetError(fmt.Errorf("offset was past end of file (%d > %d)", offset, filen), cmds.ErrNormal)
396 + res.SetError(fmt.Errorf("Offset was past end of file (%d > %d).", offset, filen), cmds.ErrNormal)
397 return
398 }
399
@@ -411,7 +411,7 @@ Examples:
411 }
412 if found {
413 if count < 0 {
414 - res.SetError(fmt.Errorf("cannot specify negative 'count'"), cmds.ErrNormal)
414 + res.SetError(fmt.Errorf("Cannot specify negative 'count'."), cmds.ErrNormal)
415 return
416 }
417 r = io.LimitReader(r, int64(count))
@@ -653,14 +653,14 @@ Examples:
653
654 var FilesFlushCmd = &cmds.Command{
655 Helptext: cmds.HelpText{
656 - Tagline: "flush a given path's data to disk",
656 + Tagline: "Flush a given path's data to disk.",
657 ShortDescription: `
658 -flush a given path to disk. This is only useful when other commands
658 +Flush a given path to disk. This is only useful when other commands
659 are run with the '--flush=false'.
660 `,
661 },
662 Arguments: []cmds.Argument{
663 - cmds.StringArg("path", false, false, "path to flush (default '/')"),
663 + cmds.StringArg("path", false, false, "Path to flush. Default: '/'."),
664 },
665 Run: func(req cmds.Request, res cmds.Response) {
666 nd, err := req.InvocContext().GetNode()
@@ -686,7 +686,7 @@ var FilesRmCmd = &cmds.Command{
686 Helptext: cmds.HelpText{
687 Tagline: "Remove a file.",
688 ShortDescription: `
689 -remove files or directories
689 +Remove files or directories.
690
691 $ ipfs files rm /foo
692 $ ipfs files ls /bar
@@ -735,7 +735,7 @@ remove files or directories
735
736 pdir, ok := parent.(*mfs.Directory)
737 if !ok {
738 - res.SetError(fmt.Errorf("no such file or directory: %s", path), cmds.ErrNormal)
738 + res.SetError(fmt.Errorf("No such file or directory: %s", path), cmds.ErrNormal)
739 return
740 }
741
@@ -827,7 +827,7 @@ func getFileHandle(r *mfs.Root, path string, create bool) (*mfs.File, error) {
827
828 fi, ok := fsn.(*mfs.File)
829 if !ok {
830 - return nil, errors.New("expected *mfs.File, didnt get it. This is likely a race condition")
830 + return nil, errors.New("Expected *mfs.File, didnt get it. This is likely a race condition.")
831 }
832 return fi, nil
833
@@ -838,11 +838,11 @@ func getFileHandle(r *mfs.Root, path string, create bool) (*mfs.File, error) {
838
839 func checkPath(p string) (string, error) {
840 if len(p) == 0 {
841 - return "", fmt.Errorf("paths must not be empty")
841 + return "", fmt.Errorf("Paths must not be empty.")
842 }
843
844 if p[0] != '/' {
845 - return "", fmt.Errorf("paths must start with a leading slash")
845 + return "", fmt.Errorf("Paths must start with a leading slash.")
846 }
847
848 cleaned := gopath.Clean(p)