Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions apps/cli/src/domains/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub mod library;
pub mod location;
pub mod logs;
pub mod network;
pub mod redundancy;
pub mod search;
pub mod spaces;
pub mod sync;
Expand Down
70 changes: 70 additions & 0 deletions apps/cli/src/domains/redundancy/args.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
use clap::Args;
use uuid::Uuid;

use sd_core::ops::redundancy::summary::RedundancySummaryInput;

#[derive(Args, Debug)]
pub struct SummaryArgs {
/// Restrict summary to specific volume UUIDs (can be specified multiple times).
/// Omit to summarize the entire library.
#[arg(long = "volume", value_name = "VOLUME_UUID")]
pub volumes: Option<Vec<Uuid>>,
}

impl From<SummaryArgs> for RedundancySummaryInput {
fn from(args: SummaryArgs) -> Self {
Self {
volume_uuids: args.volumes,
}
}
}

#[derive(Args, Debug)]
pub struct AtRiskArgs {
/// Only return files present on this volume (UUID)
#[arg(long, value_name = "VOLUME_UUID")]
pub volume: Option<Uuid>,

/// Show redundant files (content on 2+ volumes) instead of at-risk (content on 1 volume)
#[arg(long)]
pub redundant: bool,

/// Max number of files to show
#[arg(long, default_value = "50")]
pub limit: u32,

/// Pagination offset
#[arg(long, default_value = "0")]
pub offset: u32,
}

#[derive(Args, Debug)]
pub struct CompareArgs {
/// First volume UUID
pub volume_a: Uuid,

/// Second volume UUID
pub volume_b: Uuid,

/// What to compare
#[arg(long, value_enum, default_value = "unique-a")]
pub mode: CompareMode,

/// Max number of files to show
#[arg(long, default_value = "50")]
pub limit: u32,

/// Pagination offset
#[arg(long, default_value = "0")]
pub offset: u32,
}

#[derive(clap::ValueEnum, Clone, Debug)]
pub enum CompareMode {
/// Files present on volume A but not on volume B
UniqueA,
/// Files present on volume B but not on volume A
UniqueB,
/// Files present on both volumes
Shared,
}
Loading