func TestLsd(t *testing.T) { var buf bytes.Buffer err := fs.ListDir(fremote, &buf) if err != nil { t.Fatalf("ListDir failed: %v", err) } res := buf.String() if !strings.Contains(res, "sub dir\n") { t.Fatalf("Result wrong %q", res) } }
func TestLsd(t *testing.T) { r := NewRun(t) defer r.Finalise() file1 := r.WriteObject("sub dir/hello world", "hello world", t1) fstest.CheckItems(t, r.fremote, file1) var buf bytes.Buffer err := fs.ListDir(r.fremote, &buf) require.NoError(t, err) res := buf.String() assert.Contains(t, res, "sub dir\n") }
func TestLsd(t *testing.T) { r := NewRun(t) defer r.Finalise() file1 := r.WriteObject("sub dir/hello world", "hello world", t1) fstest.CheckItems(t, r.fremote, file1) var buf bytes.Buffer err := fs.ListDir(r.fremote, &buf) if err != nil { t.Fatalf("ListDir failed: %v", err) } res := buf.String() if !strings.Contains(res, "sub dir\n") { t.Fatalf("Result wrong %q", res) } }
ArgsHelp: "[remote:path]", Help: ` List all the objects in the the path with size and path.`, Run: func(fdst, fsrc fs.Fs) error { return fs.List(fdst, os.Stdout) }, MinArgs: 1, MaxArgs: 1, }, { Name: "lsd", ArgsHelp: "[remote:path]", Help: ` List all directories/containers/buckets in the the path.`, Run: func(fdst, fsrc fs.Fs) error { return fs.ListDir(fdst, os.Stdout) }, MinArgs: 1, MaxArgs: 1, }, { Name: "lsl", ArgsHelp: "[remote:path]", Help: ` List all the objects in the the path with modification time, size and path.`, Run: func(fdst, fsrc fs.Fs) error { return fs.ListLong(fdst, os.Stdout) }, MinArgs: 1, MaxArgs: 1,
package lsd import ( "os" "github.com/ncw/rclone/cmd" "github.com/ncw/rclone/fs" "github.com/spf13/cobra" ) func init() { cmd.Root.AddCommand(commandDefintion) } var commandDefintion = &cobra.Command{ Use: "lsd remote:path", Short: `List all directories/containers/buckets in the path.`, Run: func(command *cobra.Command, args []string) { cmd.CheckArgs(1, 1, command, args) fsrc := cmd.NewFsSrc(args) cmd.Run(false, false, command, func() error { return fs.ListDir(fsrc, os.Stdout) }) }, }
Run: func(fdst, fsrc fs.Fs) { err := fs.List(fdst, os.Stdout) if err != nil { log.Fatalf("Failed to list: %v", err) } }, MinArgs: 1, MaxArgs: 1, }, { Name: "lsd", ArgsHelp: "[remote:path]", Help: ` List all directories/containers/buckets in the the path.`, Run: func(fdst, fsrc fs.Fs) { err := fs.ListDir(fdst, os.Stdout) if err != nil { log.Fatalf("Failed to listdir: %v", err) } }, MinArgs: 1, MaxArgs: 1, }, { Name: "lsl", ArgsHelp: "[remote:path]", Help: ` List all the objects in the the path with modification time, size and path.`, Run: func(fdst, fsrc fs.Fs) { err := fs.ListLong(fdst, os.Stdout)