Skip to content

move examples into rustic_core crate #418

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
118 changes: 0 additions & 118 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ members = [
"crates/config",
"crates/core",
"crates/testing",
"examples/*",
]
resolver = "3"

Expand Down
39 changes: 39 additions & 0 deletions crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,42 @@ toml = "0.8.20"

[lints]
workspace = true

[[example]]
name = "backup"

[[example]]
name = "check"

[[example]]
name = "config"

[[example]]
name = "copy"

[[example]]
name = "find"

[[example]]
name = "forget"

[[example]]
name = "init"

[[example]]
name = "key"

[[example]]
name = "ls"

[[example]]
name = "merge"

[[example]]
name = "prune"

[[example]]
name = "restore"

[[example]]
name = "tag"
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! `config` example
use rustic_backend::BackendOptions;
use rustic_core::{max_compression_level, ConfigOptions, Repository, RepositoryOptions};
use rustic_core::{ConfigOptions, Repository, RepositoryOptions, max_compression_level};
use simplelog::{Config, LevelFilter, SimpleLogger};
use std::error::Error;

Expand All @@ -19,6 +19,6 @@ fn main() -> Result<(), Box<dyn Error>> {

// Set Config, e.g. Compression level
let config_opts = ConfigOptions::default().set_compression(max_compression_level());
repo.apply_config(&config_opts)?;
_ = repo.apply_config(&config_opts)?;
Ok(())
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ fn main() -> Result<(), Box<dyn Error>> {
for (snap, matches) in snapshots.iter().zip(matches) {
println!("results in {snap:?}");
for (path_idx, node_idx) in matches {
println!("path: {:?}, node: {:?}", paths[path_idx], nodes[node_idx]);
println!(
"path: {}, node: {:?}",
paths[path_idx].display(),
nodes[node_idx]
);
}
}

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ fn main() -> Result<(), Box<dyn Error>> {

// Add a new key with the given password
let key_opts = KeyOptions::default();
repo.add_key("new_password", &key_opts)?;
_ = repo.add_key("new_password", &key_opts)?;
Ok(())
}
2 changes: 1 addition & 1 deletion examples/ls/examples/ls.rs → crates/core/examples/ls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fn main() -> Result<(), Box<dyn Error>> {
let ls_opts = LsOptions::default();
for item in repo.ls(&node, &ls_opts)? {
let (path, _) = item?;
println!("{path:?} ");
println!("{}", path.display());
}
Ok(())
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! `merge` example
use rustic_backend::BackendOptions;
use rustic_core::{last_modified_node, repofile::SnapshotFile, Repository, RepositoryOptions};
use rustic_core::{Repository, RepositoryOptions, last_modified_node, repofile::SnapshotFile};
use simplelog::{Config, LevelFilter, SimpleLogger};
use std::error::Error;

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 0 additions & 16 deletions examples/backup/Cargo.toml

This file was deleted.

16 changes: 0 additions & 16 deletions examples/check/Cargo.toml

This file was deleted.

16 changes: 0 additions & 16 deletions examples/config/Cargo.toml

This file was deleted.

16 changes: 0 additions & 16 deletions examples/copy/Cargo.toml

This file was deleted.

17 changes: 0 additions & 17 deletions examples/find/Cargo.toml

This file was deleted.

Loading
Loading