-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
405 additions
and
227 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
//! `backup` example | ||
use rustic_core::{BackupOpts, PathList, Repository, RepositoryOptions, SnapshotFile}; | ||
use simplelog::{Config, LevelFilter, SimpleLogger}; | ||
|
||
fn main() { | ||
// Display info logs | ||
let _ = SimpleLogger::init(LevelFilter::Info, Config::default()); | ||
|
||
// Open repository | ||
let repo_opts = RepositoryOptions { | ||
repository: Some("/tmp/repo".to_string()), | ||
password: Some("test".to_string()), | ||
..Default::default() | ||
}; | ||
|
||
let repo = Repository::new(&repo_opts) | ||
.unwrap() | ||
.open() | ||
.unwrap() | ||
.to_indexed_ids() | ||
.unwrap(); | ||
|
||
let backup_opts = BackupOpts::default(); | ||
let source = PathList::from_string(".", true).unwrap(); // true: sanitize the given string | ||
let dry_run = false; | ||
|
||
let snap = repo | ||
.backup(&backup_opts, source, SnapshotFile::default(), dry_run) | ||
.unwrap(); | ||
|
||
println!("successfully created snapshot:\n{snap:#?}") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
pub mod backup; | ||
pub mod cat; | ||
pub mod check; | ||
pub mod config; | ||
|
Oops, something went wrong.