rustic icon indicating copy to clipboard operation
rustic copied to clipboard

Allow specifing a snapshot and a relative localpath for `rustic diff`

Open gyscos opened this issue 4 months ago • 2 comments

Currently, rustic diff has the following usage:

Usage: rustic diff [OPTIONS] <SNAPSHOT1[:PATH1]> <SNAPSHOT2[:PATH2]|PATH2>

I would like to be able to simply run:

  rustic diff $snapshot_id:$file_path

Instead, I currently have to run:

  rustic diff $snapshot_id:$file_path $file_path

Rustic already infers PATH2 to be PATH1 if a snapshot ID is given, and if no snapshot ID is given, it knows to look for local paths. I would like to combine both: if a single argument is given (no snapshot ID, no PATH2), defaults to PATH1 locally.

For the same use-case of getting the diff between a snapshot and a local file, it might also be nice to be able to specify a snapshot ID and a relative path (instead of an absolute path for PATH1 above):

    rustic diff $snapshot_id ./local_file

Or even

    rustic diff $snapshot_id local_file

(In that last one, rustic currently things local_file is a snapshot ID.)

It would then internally get the absolute path of the given file, and compare the snapshot version with that local file.

Thank you for this great tool!

gyscos avatar Jun 06 '25 15:06 gyscos