Skip to content

Commit

Permalink
Merge branch 'main' into prompt_confirm_password
Browse files Browse the repository at this point in the history
  • Loading branch information
Aderemi-Adesada committed Jun 25, 2023
2 parents 6f2dfb4 + 5cfc0d0 commit 3bbd0e5
Show file tree
Hide file tree
Showing 22 changed files with 1,740 additions and 1,464 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion changelog/new.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ New features:
- restore: Files are now allocated just before being first processed. This allows easier resumed restores.
- New option: `no-require-git` for backup - if enabled, a git repository is not required to apply `git-ignore` rule.
- fix: wait for password-command to successfully exit, allowing to input something into the command, and read password from stdout.
- Creation of new keys now enforces confirmation of entered key. This helps to prevent mistype of passwords during the initial entry
- repoinfo: Added new options --json, --only-files, --only-index
- Creation of new keys now enforces confirmation of entered key. This helps to prevent mistype of passwords during the initial entry
21 changes: 21 additions & 0 deletions crates/rustic_core/examples/prune.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//! `prune` example
use rustic_core::{PruneOpts, Repository, RepositoryOptions};
use simplelog::{Config, LevelFilter, SimpleLogger};

fn main() {
// Display info logs
let _ = SimpleLogger::init(LevelFilter::Info, Config::default());

// Open repository
let mut repo_opts = RepositoryOptions::default();
repo_opts.repository = Some("/tmp/repo".to_string());
repo_opts.password = Some("test".to_string());
let repo = Repository::new(&repo_opts).unwrap().open().unwrap();

let prune_opts = PruneOpts::default();
let prune_plan = repo.prune_plan(&prune_opts).unwrap();
println!("{:?}", prune_plan.stats);
println!("to repack: {:?}", prune_plan.repack_packs());
// to run the plan uncomment this line:
// prune_plan.do_prune(&repo, &prune_opts).unwrap();
}
8 changes: 7 additions & 1 deletion crates/rustic_core/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use std::{io::Read, path::PathBuf};
use bytes::Bytes;
use displaydoc::Display;
use log::trace;
use serde::{Deserialize, Serialize};

use crate::{backend::node::Node, error::BackendErrorKind, id::Id, RusticResult};

Expand All @@ -27,17 +28,22 @@ pub const ALL_FILE_TYPES: [FileType; 4] = [
];

/// Type for describing the kind of a file that can occur.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Display)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Display, Serialize, Deserialize)]
pub enum FileType {
/// config
#[serde(rename = "config")]
Config,
/// index
#[serde(rename = "index")]
Index,
/// keys
#[serde(rename = "key")]
Key,
/// snapshots
#[serde(rename = "snapshot")]
Snapshot,
/// data
#[serde(rename = "pack")]
Pack,
}

Expand Down
3 changes: 3 additions & 0 deletions crates/rustic_core/src/commands.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
pub mod cat;
pub mod check;
pub mod prune;
pub mod repoinfo;
pub mod snapshots;
Loading

0 comments on commit 3bbd0e5

Please sign in to comment.