mirror of
https://github.com/rclone/rclone.git
synced 2025-12-11 22:14:05 +01:00
cat: adds --separator option to cat command
When using `rclone cat` to print the contents of several files, the user may want to inject some separator between the files, such as a comma or a newline. This patch adds a `--separator` option to the `cat` command to make that possible. The default value remains an empty string, `""`, maintaining the prior behavior of `rclone cat`. Closes #6968
This commit is contained in:
@@ -824,8 +824,9 @@ func touchFiles(ctx context.Context, dateStr string, f fs.Fs, dir, glob string)
|
||||
err = nil
|
||||
buf := new(bytes.Buffer)
|
||||
size := obj.Size()
|
||||
separator := ""
|
||||
if size > 0 {
|
||||
err = operations.Cat(ctx, f, buf, 0, size)
|
||||
err = operations.Cat(ctx, f, buf, 0, size, []byte(separator))
|
||||
}
|
||||
info := object.NewStaticObjectInfo(remote, date, size, true, nil, f)
|
||||
if err == nil {
|
||||
|
||||
Reference in New Issue
Block a user