Skip to content
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
# Ensure that the latest version of Cargo is installed
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@1482605bfc5719782e1267fd0c0cc350fe7646b8 # v1
uses: dtolnay/rust-toolchain@a54c7afa936fefeb4456b2dd8068152669aa8203 # v1
with:
toolchain: stable
- uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2
Expand All @@ -43,7 +43,7 @@ jobs:
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4

- uses: EmbarkStudios/cargo-deny-action@8371184bd11e21dcf8ac82ebf8c9c9f74ebf7268 # v2
- uses: EmbarkStudios/cargo-deny-action@34899fc7ba81ca6268d5947a7a16b4649013fea1 # v2
with:
command: check bans licenses sources

Expand Down
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ version = "0.9.5"
authors = ["the rustic-rs team"]
categories = ["command-line-utilities"]
documentation = "https://docs.rs/rustic-rs"
edition = "2021"
edition = "2024"
homepage = "https://rustic.cli.rs/"
include = ["src/**/*", "LICENSE-*", "README.md", "config/**/*"]
keywords = ["backup", "restic", "deduplication", "encryption", "cli"]
license = "Apache-2.0 OR MIT"
readme = "README.md"
repository = "https://github.com/rustic-rs/rustic"
resolver = "2"
rust-version = "1.80.0"
resolver = "3"
rust-version = "1.85.0"
description = """
rustic - fast, encrypted, deduplicated backups powered by Rust
"""
Expand Down
8 changes: 5 additions & 3 deletions src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
use std::{env, process};

use abscissa_core::{
application::{self, fatal_error, AppCell},
Application, Component, FrameworkError, FrameworkErrorKind, Shutdown, StandardPaths,
application::{self, AppCell, fatal_error},
config::{self, CfgCell},
terminal::component::Terminal,
Application, Component, FrameworkError, FrameworkErrorKind, Shutdown, StandardPaths,
};

use anyhow::Result;
Expand Down Expand Up @@ -100,7 +100,9 @@ impl Application for RusticApp {

// set all given environment variables
for (env, value) in &config.global.env {
env::set_var(env, value);
unsafe {
env::set_var(env, value);
}
}

let global_hooks = config.global.hooks.clone();
Expand Down
10 changes: 5 additions & 5 deletions src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ use crate::commands::mount::MountCmd;
#[cfg(feature = "webdav")]
use crate::commands::webdav::WebDavCmd;
use crate::{
Application, RUSTIC_APP,
commands::{
backup::BackupCmd, cat::CatCmd, check::CheckCmd, completions::CompletionsCmd,
config::ConfigCmd, copy::CopyCmd, diff::DiffCmd, docs::DocsCmd, dump::DumpCmd,
Expand All @@ -51,21 +52,20 @@ use crate::{
tag::TagCmd,
},
config::RusticConfig,
Application, RUSTIC_APP,
};

use abscissa_core::{
config::Override, terminal::ColorChoice, Command, Configurable, FrameworkError,
FrameworkErrorKind, Runnable, Shutdown,
Command, Configurable, FrameworkError, FrameworkErrorKind, Runnable, Shutdown,
config::Override, terminal::ColorChoice,
};
use anyhow::Result;
use clap::builder::{
styling::{AnsiColor, Effects},
Styles,
styling::{AnsiColor, Effects},
};
use convert_case::{Case, Casing};
use human_panic::setup_panic;
use log::{info, log, Level};
use log::{Level, info, log};
use simplelog::{CombinedLogger, LevelFilter, TermLogger, TerminalMode, WriteLogger};

use self::find::FindCmd;
Expand Down
15 changes: 9 additions & 6 deletions src/commands/backup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ use std::path::PathBuf;
use std::{collections::BTreeMap, env};

use crate::{
Application, RUSTIC_APP,
commands::{init::init, snapshots::fill_table},
config::{hooks::Hooks, parse_labels},
helpers::{bold_cell, bytes_size_to_string, table},
repository::CliRepo,
status_err, Application, RUSTIC_APP,
status_err,
};

use abscissa_core::{Command, Runnable, Shutdown};
use anyhow::{anyhow, bail, Context, Result};
use anyhow::{Context, Result, anyhow, bail};
use clap::ValueHint;
use comfy_table::Cell;
use conflate::Merge;
Expand All @@ -21,9 +22,9 @@ use serde::{Deserialize, Serialize};
use serde_with::serde_as;

use rustic_core::{
repofile::SnapshotFile, BackupOptions, CommandInput, ConfigOptions, IndexedIds, KeyOptions,
LocalSourceFilterOptions, LocalSourceSaveOptions, ParentOptions, PathList, ProgressBars,
Repository, SnapshotOptions,
BackupOptions, CommandInput, ConfigOptions, IndexedIds, KeyOptions, LocalSourceFilterOptions,
LocalSourceSaveOptions, ParentOptions, PathList, ProgressBars, Repository, SnapshotOptions,
repofile::SnapshotFile,
};

/// `backup` subcommand
Expand Down Expand Up @@ -358,7 +359,9 @@ impl BackupCmd {
}
#[cfg(not(feature = "prometheus"))]
{
warn!("not pushing prometheus metrics - this rustic version is compiled without prometheus support");
warn!(
"not pushing prometheus metrics - this rustic version is compiled without prometheus support"
);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/commands/cat.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! `cat` subcommand

use crate::{status_err, Application, RUSTIC_APP};
use crate::{Application, RUSTIC_APP, status_err};

use abscissa_core::{Command, Runnable, Shutdown};

Expand Down
2 changes: 1 addition & 1 deletion src/commands/check.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! `check` subcommand

use crate::{repository::CliOpenRepo, status_err, Application, RUSTIC_APP};
use crate::{Application, RUSTIC_APP, repository::CliOpenRepo, status_err};

use abscissa_core::{Command, Runnable, Shutdown};
use anyhow::Result;
Expand Down
2 changes: 1 addition & 1 deletion src/commands/completions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::io::Write;

use clap::CommandFactory;

use clap_complete::{generate, shells, Generator};
use clap_complete::{Generator, generate, shells};

/// `completions` subcommand
#[derive(clap::Parser, Command, Debug)]
Expand Down
2 changes: 1 addition & 1 deletion src/commands/config.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! `config` subcommand

use crate::{status_err, Application, RUSTIC_APP};
use crate::{Application, RUSTIC_APP, status_err};

use abscissa_core::{Command, Runnable, Shutdown};

Expand Down
19 changes: 12 additions & 7 deletions src/commands/copy.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
//! `copy` subcommand

use crate::{
Application, RUSTIC_APP, RusticConfig,
commands::init::init_password,
helpers::table_with_titles,
repository::{CliIndexedRepo, CliRepo},
status_err, Application, RusticConfig, RUSTIC_APP,
status_err,
};
use abscissa_core::{config::Override, Command, FrameworkError, Runnable, Shutdown};
use anyhow::{bail, Result};
use abscissa_core::{Command, FrameworkError, Runnable, Shutdown, config::Override};
use anyhow::{Result, bail};
use conflate::Merge;
use log::{error, info, log, Level};
use log::{Level, error, info, log};
use serde::{Deserialize, Serialize};

use rustic_core::{repofile::SnapshotFile, CopySnapshot, Id, KeyOptions};
use rustic_core::{CopySnapshot, Id, KeyOptions, repofile::SnapshotFile};

/// `copy` subcommand
#[derive(clap::Parser, Command, Default, Clone, Debug, Serialize, Deserialize, Merge)]
Expand Down Expand Up @@ -58,7 +59,9 @@ impl Runnable for CopyCmd {
fn run(&self) {
let config = RUSTIC_APP.config();
if config.copy.targets.is_empty() {
status_err!("No target given. Please specify at least 1 target either in the profile or using --target!");
status_err!(
"No target given. Please specify at least 1 target either in the profile or using --target!"
);
RUSTIC_APP.shutdown(Shutdown::Crash);
}
if let Err(err) = config.repository.run_indexed(|repo| self.inner_run(repo)) {
Expand Down Expand Up @@ -118,7 +121,9 @@ impl CopyCmd {
};

if repo.config().poly()? != target_repo.config().poly()? {
bail!("cannot copy to repository with different chunker parameter (re-chunking not implemented)!");
bail!(
"cannot copy to repository with different chunker parameter (re-chunking not implemented)!"
);
}

let snaps = target_repo.relevant_copy_snapshots(
Expand Down
6 changes: 3 additions & 3 deletions src/commands/diff.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! `diff` subcommand

use crate::{repository::CliIndexedRepo, status_err, Application, RUSTIC_APP};
use crate::{Application, RUSTIC_APP, repository::CliIndexedRepo, status_err};

use abscissa_core::{Command, Runnable, Shutdown};
use clap::ValueHint;
Expand All @@ -11,12 +11,12 @@ use std::{
path::{Path, PathBuf},
};

use anyhow::{bail, Context, Result};
use anyhow::{Context, Result, bail};

use rustic_core::{
repofile::{Node, NodeType},
IndexedFull, LocalDestination, LocalSource, LocalSourceFilterOptions, LocalSourceSaveOptions,
LsOptions, ReadSource, ReadSourceEntry, Repository, RusticResult,
repofile::{Node, NodeType},
};

/// `diff` subcommand
Expand Down
4 changes: 2 additions & 2 deletions src/commands/docs.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
//! `docs` subcommand

use abscissa_core::{status_err, Application, Command, Runnable, Shutdown};
use abscissa_core::{Application, Command, Runnable, Shutdown, status_err};
use anyhow::Result;
use clap::Subcommand;

use crate::{
application::constants::{RUSTIC_CONFIG_DOCS_URL, RUSTIC_DEV_DOCS_URL, RUSTIC_DOCS_URL},
RUSTIC_APP,
application::constants::{RUSTIC_CONFIG_DOCS_URL, RUSTIC_DEV_DOCS_URL, RUSTIC_DOCS_URL},
};

#[derive(Command, Debug, Clone, Copy, Default, Subcommand, Runnable)]
Expand Down
10 changes: 5 additions & 5 deletions src/commands/dump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@

use std::{
fs::File,
io::{copy, Cursor, Read, Seek, SeekFrom, Write},
io::{Cursor, Read, Seek, SeekFrom, Write, copy},
path::PathBuf,
};

use crate::{repository::CliIndexedRepo, status_err, Application, RUSTIC_APP};
use crate::{Application, RUSTIC_APP, repository::CliIndexedRepo, status_err};

use abscissa_core::{Command, Runnable, Shutdown};
use anyhow::Result;
use derive_more::FromStr;
use flate2::{write::GzEncoder, Compression};
use flate2::{Compression, write::GzEncoder};
use log::warn;
use rustic_core::{
LsOptions,
repofile::{Node, NodeType},
vfs::OpenFile,
LsOptions,
};
use tar::{Builder, EntryType, Header};
use zip::{write::SimpleFileOptions, ZipWriter};
use zip::{ZipWriter, write::SimpleFileOptions};

/// `dump` subcommand
#[derive(clap::Parser, Command, Debug)]
Expand Down
4 changes: 2 additions & 2 deletions src/commands/find.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use std::path::{Path, PathBuf};

use crate::{repository::CliIndexedRepo, status_err, Application, RUSTIC_APP};
use crate::{Application, RUSTIC_APP, repository::CliIndexedRepo, status_err};

use abscissa_core::{Command, Runnable, Shutdown};
use anyhow::Result;
Expand All @@ -11,8 +11,8 @@ use globset::{Glob, GlobBuilder, GlobSetBuilder};
use itertools::Itertools;

use rustic_core::{
repofile::{Node, SnapshotFile},
FindMatches, FindNode, SnapshotGroupCriterion,
repofile::{Node, SnapshotFile},
};

use super::ls::print_node;
Expand Down
6 changes: 3 additions & 3 deletions src/commands/forget.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
//! `forget` subcommand

use crate::repository::CliOpenRepo;
use crate::{helpers::table_with_titles, status_err, Application, RusticConfig, RUSTIC_APP};
use crate::{Application, RUSTIC_APP, RusticConfig, helpers::table_with_titles, status_err};

use abscissa_core::{config::Override, Shutdown};
use abscissa_core::{Command, FrameworkError, Runnable};
use abscissa_core::{Shutdown, config::Override};
use anyhow::Result;

use chrono::Local;
use conflate::Merge;
use serde::{Deserialize, Serialize};
use serde_with::{serde_as, DisplayFromStr};
use serde_with::{DisplayFromStr, serde_as};

use crate::{commands::prune::PruneCmd, filtering::SnapshotFilter};

Expand Down
6 changes: 3 additions & 3 deletions src/commands/init.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
//! `init` subcommand

use abscissa_core::{status_err, Command, Runnable, Shutdown};
use anyhow::{bail, Result};
use abscissa_core::{Command, Runnable, Shutdown, status_err};
use anyhow::{Result, bail};
use dialoguer::Password;

use crate::{repository::CliRepo, Application, RUSTIC_APP};
use crate::{Application, RUSTIC_APP, repository::CliRepo};

use rustic_core::{ConfigOptions, KeyOptions, OpenStatus, Repository};

Expand Down
2 changes: 1 addition & 1 deletion src/commands/key.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! `key` subcommand

use crate::{repository::CliOpenRepo, status_err, Application, RUSTIC_APP};
use crate::{Application, RUSTIC_APP, repository::CliOpenRepo, status_err};

use std::path::PathBuf;

Expand Down
4 changes: 2 additions & 2 deletions src/commands/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

use std::num::NonZero;

use crate::{repository::CliOpenRepo, status_err, Application, RUSTIC_APP};
use crate::{Application, RUSTIC_APP, repository::CliOpenRepo, status_err};

use abscissa_core::{Command, Runnable, Shutdown};
use anyhow::{bail, Result};
use anyhow::{Result, bail};

use rustic_core::repofile::{IndexFile, IndexId, KeyId, PackId, SnapshotId};

Expand Down
4 changes: 2 additions & 2 deletions src/commands/ls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

use std::path::Path;

use crate::{repository::CliIndexedRepo, status_err, Application, RUSTIC_APP};
use crate::{Application, RUSTIC_APP, repository::CliIndexedRepo, status_err};

use abscissa_core::{Command, Runnable, Shutdown};
use anyhow::Result;

use rustic_core::{
repofile::{Node, NodeType},
LsOptions,
repofile::{Node, NodeType},
};

mod constants {
Expand Down
4 changes: 2 additions & 2 deletions src/commands/merge.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
//! `merge` subcommand

use crate::{repository::CliOpenRepo, status_err, Application, RUSTIC_APP};
use crate::{Application, RUSTIC_APP, repository::CliOpenRepo, status_err};
use abscissa_core::{Command, Runnable, Shutdown};
use anyhow::Result;
use log::info;

use chrono::Local;

use rustic_core::{last_modified_node, repofile::SnapshotFile, SnapshotOptions};
use rustic_core::{SnapshotOptions, last_modified_node, repofile::SnapshotFile};

/// `merge` subcommand
#[derive(clap::Parser, Default, Command, Debug)]
Expand Down
Loading