Text output enhancements

I have a few ideas that might improve restic’s output:

1. add some form of progress bar to the copy cmd. Right now all you see is

   copy started, this may take a while...
 snapshot 1ace971d saved

With some arbitrary amount of time between those two lines. :slight_smile:

Maybe x/y chunks, or files if they’re available. Something like backup -v shows would be very helpful.

2. add args to control output of snapshots cmd

Right now you can change a few formatting options, but not the sort order or number of snapshots displayed, unless you only want to see the --last.

It would be great to add args to:

a. control sort order. Right now it’s chronological, with oldest first. Reversing would be useful so the newest is on top
b. control number of records printed. then you can show the first 10 or last 10 (when combined with reverse above) snapshots

While we’re here, the --last flag seems inconsistent with the ‘latest’ keyword used elsewhere.

3. clarify backup -v -v printouts

One of three things will be printed out for each file:

a. new /data/a/a0.bin, saved in 10.772s (100.000 MiB added)
b. new /data/a/a0.bin, saved in 3.450s (0 B added)
c. unchanged /data/a/a0.bin

I thiiiiiiink this is what they mean:

a. no parent metadata found, new chunks were added to the repo
b. no parent metadata found, file unchanged and no new chunks added to the repo
c. parent metadata found, file unchanged and not scanned again

I’m not sure how to better represent this info (or even what info would be best to expose here) but it seems like there is room for improvement.

Just a strawman:

/path/to/file changed (hash), saved 100.000MiB in 12.05s
/path/to/file2 unchanged (parent)
/path/to/file3 unchanged (hash), hashed 1234.56MiB in 11.302s

Overall, any thoughts?

1. add some form of progress bar to the copy cmd.

We already have https://github.com/restic/restic/issues/2923 to track that feature request. The problem is that just finding out how many chunks / files a snapshot has, currently requires running a substantial part of the copy command twice.

2. add args to control output of snapshots cmd

If I’m not completely mistaken, then --last applies on a per group basis whereas latest is only a single snapshots.

3. clarify backup -v -v printouts

“b.” should read as “no parent metadata found, but file chunks are already contained in the repository”. Actually the description for “a.” isn’t accurate either. The output for that file could report adding less bytes than the file is large. In that case the accurate description would be a mix of a and b.

“New”/ “unchanged” has meaning in respect to the selected parent snapshot. The “bytes added” information tells how much data was added to the repository while backing up that file. That is probably the most relevant information for a user.

As a workaround, you can already use snapshots --json and use any jq magic you need to get your desired output.