Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
b9f4aa5
feat(commands): copy can use latest~N to identify snapshots
nardoor Sep 15, 2025
0e55866
feat(commands): forget can use latest~N to identify snapshots
nardoor Sep 15, 2025
49f24c9
docs(commands): ls can use latest~N syntax for snapshots
nardoor Sep 15, 2025
0f13f31
docs(commands): check can use latest and latest~N
nardoor Sep 15, 2025
a13a392
docs(commands): skip a line to make it easier to read
nardoor Sep 15, 2025
401fe93
feat(commands): diff can use latest~N to identify snapshots
nardoor Sep 15, 2025
f2dca1f
docs(commands): dump can use latest~N to identify a snapshot
nardoor Sep 15, 2025
e4c157a
docs(commands): find can use latest~N to identify snapshots
nardoor Sep 15, 2025
cef1a69
feat(commands): merge can use latest and latest~N to identify snapshots
nardoor Sep 15, 2025
abe6461
docs(commands): mount can use latest~N to identify snapshot
nardoor Sep 15, 2025
406b0a0
feat(commands): repair can use latest~N to identify snapshots
nardoor Sep 15, 2025
c8947e4
docs(commands): restore can use latest~N to identify snapshot
nardoor Sep 15, 2025
d75670e
docs(commands): snapshots can use latest~N to identify snapshots
nardoor Sep 15, 2025
44ce845
feat(commands): tag can use latest~N to identify snapshots
nardoor Sep 15, 2025
b510f4a
docs(comands): webdav can use latest~N to identify snapshots
nardoor Sep 15, 2025
263a08f
Merge branch 'main' into feature/broad_snapshot_id
nardoor Jan 12, 2026
3a46768
fix: typo
nardoor Jan 12, 2026
e6a3c1f
feat(commands): rewrite can use latest~N to identify snapshots
nardoor Jan 12, 2026
40dfbe2
fix(commands): use snapshot filters for merge,forget,diff
nardoor Jan 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/commands/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ use rustic_core::CheckOptions;
#[derive(clap::Parser, Command, Debug)]
pub(crate) struct CheckCmd {
/// Snapshots to check. If none is given, use filter options to filter from all snapshots
///
/// Snapshots can be identified the following ways: "01a2b3c4" or "latest" or "latest~N" (N >= 0)
#[clap(value_name = "ID")]
ids: Vec<String>,

Expand Down
6 changes: 4 additions & 2 deletions src/commands/copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ use rustic_core::{CopySnapshot, Id, KeyOptions, repofile::SnapshotFile};
/// `copy` subcommand
#[derive(clap::Parser, Command, Default, Clone, Debug, Serialize, Deserialize, Merge)]
pub struct CopyCmd {
/// Snapshots to copy. If none is given, use filter options to filter from all snapshots.
/// Snapshots to copy. If none is given, use filter options to filter from all snapshots
///
/// Snapshots can be identified the following ways: "01a2b3c4" or "latest" or "latest~N" (N >= 0)
#[clap(value_name = "ID")]
#[serde(skip)]
#[merge(skip)]
Expand Down Expand Up @@ -77,7 +79,7 @@ impl CopyCmd {
let mut snapshots = if self.ids.is_empty() {
get_filtered_snapshots(&repo)?
} else {
repo.get_snapshots(&self.ids)?
repo.get_snapshots_from_strs(&self.ids, |sn| config.snapshot_filter.matches(sn))?
};
// sort for nicer output
snapshots.sort_unstable();
Expand Down
8 changes: 7 additions & 1 deletion src/commands/diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,14 @@ use crate::commands::tui;
#[derive(clap::Parser, Command, Debug)]
pub(crate) struct DiffCmd {
/// Reference snapshot/path
///
/// Snapshot can be identified the following ways: "01a2b3c4" or "latest" or "latest~N" (N >= 0)
#[clap(value_name = "SNAPSHOT1[:PATH1]")]
snap1: String,

/// New snapshot/path (uses PATH2 = PATH1, if not given; uses local path if no snapshot is given)
///
/// Snapshot can be identified the following ways: "01a2b3c4" or "latest" or "latest~N" (N >= 0)
#[clap(value_name = "SNAPSHOT2[:PATH2]|PATH2", value_hint = ValueHint::AnyPath)]
snap2: Option<String>,

Expand Down Expand Up @@ -83,7 +87,9 @@ impl DiffCmd {
match (id1, id2) {
(Some(id1), Some(id2)) => {
// diff between two snapshots
let snaps = repo.get_snapshots(&[id1, id2])?;
let snaps = repo.get_snapshots_from_strs(&[id1, id2], |sn| {
config.snapshot_filter.matches(sn)
})?;

let snap1 = &snaps[0];
let snap2 = &snaps[1];
Expand Down
2 changes: 2 additions & 0 deletions src/commands/dump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ use zip::{ZipWriter, write::SimpleFileOptions};
#[derive(clap::Parser, Command, Debug)]
pub(crate) struct DumpCmd {
/// file from snapshot to dump
///
/// Snapshot can be identified the following ways: "01a2b3c4" or "latest" or "latest~N" (N >= 0)
#[clap(value_name = "SNAPSHOT[:PATH]")]
snap: String,

Expand Down
2 changes: 2 additions & 0 deletions src/commands/find.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ pub(crate) struct FindCmd {
path: Option<PathBuf>,

/// Snapshots to search in. If none is given, use filter options to filter from all snapshots
///
/// Snapshots can be identified the following ways: "01a2b3c4" or "latest" or "latest~N" (N >= 0)
#[clap(value_name = "ID")]
ids: Vec<String>,

Expand Down
4 changes: 3 additions & 1 deletion src/commands/forget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ use rustic_core::{
#[derive(clap::Parser, Command, Debug)]
pub(super) struct ForgetCmd {
/// Snapshots to forget. If none is given, use filter options to filter from all snapshots
///
/// Snapshots can be identified the following ways: "01a2b3c4" or "latest" or "latest~N" (N >= 0)
#[clap(value_name = "ID")]
ids: Vec<String>,

Expand Down Expand Up @@ -127,7 +129,7 @@ impl ForgetCmd {
let item = ForgetGroup {
group: SnapshotGroup::default(),
snapshots: repo
.get_snapshots(&self.ids)?
.get_snapshots_from_strs(&self.ids, |sn| config.snapshot_filter.matches(sn))?
.into_iter()
.map(|sn| {
if sn.must_keep(&now) {
Expand Down
4 changes: 3 additions & 1 deletion src/commands/ls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ use constants::{S_IRGRP, S_IROTH, S_IRUSR, S_IWGRP, S_IWOTH, S_IWUSR, S_IXGRP, S
/// `ls` subcommand
#[derive(clap::Parser, Command, Debug)]
pub(crate) struct LsCmd {
/// Snapshot/path to list
/// Snapshot:path to list
///
/// The snapshot can be an id: "01a2b3c4" or "latest" or "latest~N" (N >= 0)
#[clap(value_name = "SNAPSHOT[:PATH]")]
snap: String,

Expand Down
2 changes: 1 addition & 1 deletion src/commands/merge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl MergeCmd {
let snapshots = if self.ids.is_empty() {
get_filtered_snapshots(&repo)?
} else {
repo.get_snapshots(&self.ids)?
repo.get_snapshots_from_strs(&self.ids, |sn| config.snapshot_filter.matches(sn))?
};

// Handle dry-run mode
Expand Down
2 changes: 2 additions & 0 deletions src/commands/mount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ pub struct MountCmd {
mount_point: Option<PathBuf>,

/// Specify directly which snapshot/path to mount
///
/// Snapshot can be identified the following ways: "01a2b3c4" or "latest" or "latest~N" (N >= 0)
#[clap(value_name = "SNAPSHOT[:PATH]")]
#[merge(strategy=conflate::option::overwrite_none)]
snapshot_path: Option<String>,
Expand Down
6 changes: 4 additions & 2 deletions src/commands/repair.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ struct SnapSubCmd {
#[clap(flatten)]
opts: RepairSnapshotsOptions,

/// Snapshots to repair. If none is given, use filter to filter from all snapshots.
/// Snapshots to repair. If none is given, use filter to filter from all snapshots
///
/// Snapshots can be identified the following ways: "01a2b3c4" or "latest" or "latest~N" (N >= 0)
#[clap(value_name = "ID")]
ids: Vec<String>,
}
Expand Down Expand Up @@ -86,7 +88,7 @@ impl SnapSubCmd {
let snaps = if self.ids.is_empty() {
repo.get_all_snapshots()?
} else {
repo.get_snapshots(&self.ids)?
repo.get_snapshots_from_strs(&self.ids, |_| true)?
};
repo.repair_snapshots(&self.opts, snaps, config.global.dry_run)?;
Ok(())
Expand Down
2 changes: 2 additions & 0 deletions src/commands/restore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ use crate::filtering::SnapshotFilter;
#[derive(clap::Parser, Command, Debug)]
pub(crate) struct RestoreCmd {
/// Snapshot/path to restore
///
/// Snapshot can be identified the following ways: "01a2b3c4" or "latest" or "latest~N" (N >= 0)
#[clap(value_name = "SNAPSHOT[:PATH]")]
snap: String,

Expand Down
4 changes: 3 additions & 1 deletion src/commands/rewrite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ use rustic_core::{StringList, repofile::DeleteOption};
#[derive(clap::Parser, Command, Debug, Default)]
pub(crate) struct RewriteCmd {
/// Snapshots to rewrite. If none is given, use filter to filter from all snapshots.
///
/// Snapshot can be identified the following ways: "01a2b3c4" or "latest" or "latest~N" (N >= 0)
#[clap(value_name = "ID")]
pub ids: Vec<String>,

Expand Down Expand Up @@ -112,7 +114,7 @@ impl RewriteCmd {
let snapshots = if self.ids.is_empty() {
get_filtered_snapshots(&repo)?
} else {
repo.get_snapshots(&self.ids)?
repo.get_snapshots_from_strs(&self.ids, |sn| config.snapshot_filter.matches(sn))?
};

let delete = match (
Expand Down
4 changes: 3 additions & 1 deletion src/commands/snapshots.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! `smapshot` subcommand
//! `snapshot` subcommand

use crate::{
Application, RUSTIC_APP,
Expand Down Expand Up @@ -27,6 +27,8 @@ use crate::commands::tui;
#[derive(clap::Parser, Command, Debug)]
pub(crate) struct SnapshotCmd {
/// Snapshots to show. If none is given, use filter options to filter from all snapshots
///
/// Snapshots can be identified the following ways: "01a2b3c4" or "latest" or "latest~N" (N >= 0)
#[clap(value_name = "ID")]
ids: Vec<String>,

Expand Down
5 changes: 3 additions & 2 deletions src/commands/tag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ use crate::commands::rewrite::RewriteCmd;
/// `tag` subcommand
#[derive(clap::Parser, Command, Debug)]
pub(crate) struct TagCmd {
/// Snapshots to change tags. If none is given, use filter to filter from all
/// snapshots.
/// Snapshots to change tags. If none is given, use filter to filter from all snapshots
///
/// Snapshots can be identified the following ways: "01a2b3c4" or "latest" or "latest~N" (N >= 0)
#[clap(value_name = "ID")]
ids: Vec<String>,

Expand Down
2 changes: 2 additions & 0 deletions src/commands/webdav.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ pub struct WebDavCmd {
file_access: Option<String>,

/// Specify directly which snapshot/path to serve
///
/// Snapshot can be identified the following ways: "01a2b3c4" or "latest" or "latest~N" (N >= 0)
#[clap(value_name = "SNAPSHOT[:PATH]")]
#[merge(strategy=conflate::option::overwrite_none)]
snapshot_path: Option<String>,
Expand Down
Loading