Skip to content

Commit

Permalink
feat(catalog): initial support for describe
Browse files Browse the repository at this point in the history
  • Loading branch information
graelo committed Aug 18, 2022
1 parent d754072 commit 444b0f5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ pub enum CatalogSubcommand {
#[clap(long = "only", value_enum, value_parser)]
sublist: Option<SubList>,
},
/// Describe the content of a backup file.
Describe {
/// Path to the backup file.
#[clap(value_parser, value_hint = ValueHint::FilePath)]
backup_filepath: PathBuf,
},
/// Delete outdated backups by applying the catalog's compaction strategy.
Compact,
}
Expand Down
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ async fn run(config: Config) {
match config.command {
Command::Catalog { command } => match command {
CatalogSubcommand::List { sublist } => catalog.list(sublist),
CatalogSubcommand::Describe { backup_filepath } => catalog.describe(backup_filepath),
CatalogSubcommand::Compact => match catalog.compact().await {
Ok(n) => {
let message = format!("✅ deleted {n} outdated backups");
Expand Down
10 changes: 10 additions & 0 deletions src/management/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,16 @@ impl Catalog {
);
}
}

pub fn describe<P>(&self, backup_filepath: P)
where
P: AsRef<Path>,
{
println!(
"describing `{}`",
backup_filepath.as_ref().to_string_lossy()
);
}
}

// Private functions
Expand Down

0 comments on commit 444b0f5

Please sign in to comment.