Compare commits
3 Commits
3ef29ba7bc
...
64a874252a
| Author | SHA1 | Date | |
|---|---|---|---|
|
64a874252a
|
|||
|
c6b3934ca5
|
|||
|
3af70f3647
|
22
Cargo.lock
generated
22
Cargo.lock
generated
@ -42,7 +42,7 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||
|
||||
[[package]]
|
||||
name = "butterup"
|
||||
version = "1.1.0"
|
||||
version = "1.1.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"chrono",
|
||||
@ -161,9 +161,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "1.8.1"
|
||||
version = "1.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0f647032dfaa1f8b6dc29bd3edb7bbef4861b8b8007ebb118d6db284fd59f6ee"
|
||||
checksum = "e6012d540c5baa3589337a98ce73408de9b5a25ec9fc2c6fd6be8f0d39e0ca5a"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"hashbrown",
|
||||
@ -206,9 +206,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libz-sys"
|
||||
version = "1.1.6"
|
||||
version = "1.1.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "92e7e15d7610cce1d9752e137625f14e61a28cd45929b6e12e47b50fe154ee2e"
|
||||
checksum = "9702761c3935f8cc2f101793272e202c72b99da8f4224a19ddcf1279a6450bbf"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
@ -285,9 +285,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "os_str_bytes"
|
||||
version = "6.0.1"
|
||||
version = "6.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "029d8d0b2f198229de29dca79676f2738ff952edf3fde542eb8bf94d8c21b435"
|
||||
checksum = "21326818e99cfe6ce1e524c2a805c189a99b5ae555a35d19f9a284b427d86afa"
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot"
|
||||
@ -389,9 +389,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.5.5"
|
||||
version = "1.5.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286"
|
||||
checksum = "d83f127d94bdbcda4c8cc2e50f6f84f4b611f69c902699ca385a39c3a75f9ff1"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
@ -400,9 +400,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.6.25"
|
||||
version = "0.6.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
|
||||
checksum = "49b3de9ec5dc0a3417da371aab17d729997c15010e7fd24ff707773a33bddb64"
|
||||
|
||||
[[package]]
|
||||
name = "scopeguard"
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "butterup"
|
||||
description = "Backup btrfs snapshots over SSH"
|
||||
version = "1.1.0"
|
||||
version = "1.1.1"
|
||||
authors = ["Joakim Hulthe <joakim@hulthe.net>"]
|
||||
license = "MPL-2.0"
|
||||
edition = "2018"
|
||||
|
||||
20
src/main.rs
20
src/main.rs
@ -10,6 +10,7 @@ mod util;
|
||||
use actions::{list, show_plan, sync};
|
||||
use chrono::{DateTime, FixedOffset};
|
||||
use clap::{crate_version, Parser};
|
||||
use log::LevelFilter;
|
||||
use remote::Remote;
|
||||
use std::collections::BTreeMap;
|
||||
use std::path::PathBuf;
|
||||
@ -21,6 +22,14 @@ pub type FileList = BTreeMap<TimeStamp, String>;
|
||||
#[derive(Parser)]
|
||||
#[clap(version = crate_version!())]
|
||||
pub struct Opt {
|
||||
/// Log more stuff
|
||||
#[clap(long, short, parse(from_occurrences))]
|
||||
verbose: u8,
|
||||
|
||||
/// Do not output anything but errors.
|
||||
#[clap(long, short)]
|
||||
quiet: bool,
|
||||
|
||||
/// The path of the backup directory on the local filesystem
|
||||
#[clap(short = 'l', long)]
|
||||
path: PathBuf,
|
||||
@ -64,7 +73,16 @@ pub enum Action {
|
||||
fn main() -> anyhow::Result<()> {
|
||||
let opt = Opt::parse();
|
||||
|
||||
pretty_env_logger::init();
|
||||
let log_level = match opt.verbose {
|
||||
0 if opt.quiet => LevelFilter::Error,
|
||||
0 => LevelFilter::Info,
|
||||
1 => LevelFilter::Debug,
|
||||
2.. => LevelFilter::Trace,
|
||||
};
|
||||
|
||||
pretty_env_logger::formatted_builder()
|
||||
.filter(None, log_level)
|
||||
.init();
|
||||
|
||||
match opt.action {
|
||||
Action::Backup { all } => sync::run(&opt, all)?,
|
||||
|
||||
Reference in New Issue
Block a user