From f82dbb8755ceca0f1448d0b516b6a88515f0fdb8 Mon Sep 17 00:00:00 2001 From: taskylizard <75871323+taskylizard@users.noreply.github.com> Date: Sun, 9 Mar 2025 05:22:02 +0000 Subject: [PATCH] chore: upgrade project --- .github/workflows/coverage.yml | 38 ++++++++++++++-------------- .github/workflows/crates.yml | 46 +++++++++++++++++----------------- .github/workflows/rust.yml | 12 ++++----- Cargo.toml | 46 +++++++++++++++++----------------- src/algorithms.rs | 6 ++--- src/error.rs | 2 +- src/hashing/blake2b.rs | 2 +- src/hashing/blake2s.rs | 2 +- src/hashing/blake3.rs | 2 +- src/hashing/crc32.rs | 2 +- src/hashing/md5.rs | 2 +- src/hashing/mod.rs | 2 +- src/hashing/sha1.rs | 2 +- src/hashing/sha2_224.rs | 2 +- src/hashing/sha2_256.rs | 2 +- src/hashing/sha2_384.rs | 2 +- src/hashing/sha2_512.rs | 2 +- src/hashing/sha3_224.rs | 2 +- src/hashing/sha3_256.rs | 2 +- src/hashing/sha3_384.rs | 2 +- src/hashing/sha3_512.rs | 2 +- src/hashing/whirlpool.rs | 2 +- src/hashing/xxh3.rs | 2 +- src/hashing/xxh32.rs | 2 +- src/hashing/xxh64.rs | 2 +- src/lib.rs | 19 +++----------- src/main.rs | 4 +-- src/operations/compare.rs | 2 +- src/operations/mod.rs | 12 ++++----- src/operations/write.rs | 4 +-- src/options.rs | 30 +++++++++++----------- src/utilities.rs | 2 +- 32 files changed, 125 insertions(+), 136 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 1ad7929..ba48b28 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -6,28 +6,28 @@ env: CARGO_TERM_COLOR: always jobs: test: - name: 'coverage' + name: "coverage" runs-on: ${{ matrix.os }} strategy: matrix: build: [stable] include: - - build: stable - os: ubuntu-latest - rust: nightly + - build: stable + os: ubuntu-latest + rust: nightly steps: - - name: 'Checkout repository' - uses: actions/checkout@v2.3.4 - with: - fetch-depth: 1 - - - name: 'Enable caching' - uses: Swatinem/rust-cache@v1.3.0 - - - name: Push to codecov.io - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - run: | - cargo install cargo-tarpaulin - cargo tarpaulin --verbose --all-features --workspace --timeout 120 --out Xml - bash <(curl -s https://codecov.io/bash) -X gcov -t $CODECOV_TOKEN + - name: "Checkout repository" + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: "Enable caching" + uses: Swatinem/rust-cache@v2 + + - name: Push to codecov.io + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + run: | + cargo install cargo-tarpaulin + cargo tarpaulin --verbose --all-features --workspace --timeout 120 --out Xml + bash <(curl -s https://codecov.io/bash) -X gcov -t $CODECOV_TOKEN diff --git a/.github/workflows/crates.yml b/.github/workflows/crates.yml index afaa639..b7f79c3 100644 --- a/.github/workflows/crates.yml +++ b/.github/workflows/crates.yml @@ -9,33 +9,33 @@ env: CARGO_TERM_COLOR: always jobs: test: - name: 'publish' + name: "publish" runs-on: ${{ matrix.os }} strategy: matrix: build: [linux] include: - - build: linux - os: ubuntu-latest - rust: stable + - build: linux + os: ubuntu-latest + rust: stable steps: - - name: 'Checkout repository' - uses: actions/checkout@v2.3.4 - with: - fetch-depth: 1 - - - name: 'Install Rust' - uses: actions-rs/toolchain@v1.0.6 - with: - toolchain: ${{ matrix.rust }} - override: true - profile: default - - - name: 'Enable caching' - uses: Swatinem/rust-cache@v1.3.0 + - name: "Checkout repository" + uses: actions/checkout@v4 + with: + fetch-depth: 1 - - name: 'Publish on crates.io' - uses: actions-rs/cargo@v1.0.1 - with: - command: publish - args: --verbose --all-features --token ${{ secrets.CARGO_REGISTRY_TOKEN }} + - name: "Install Rust" + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.rust }} + override: true + profile: default + + - name: "Enable caching" + uses: Swatinem/rust-cache@v2 + + - name: "Publish on crates.io" + uses: actions-rs/cargo@v1 + with: + command: publish + args: --verbose --all-features --token ${{ secrets.CARGO_REGISTRY_TOKEN }} diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index df5b2e7..1ffe2e6 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -72,7 +72,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Setup Rust toolchain uses: actions-rs/toolchain@v1 @@ -80,14 +80,14 @@ jobs: toolchain: stable target: ${{ matrix.target }} - - name: 'Enable caching' - uses: Swatinem/rust-cache@v1 + - name: "Enable caching" + uses: Swatinem/rust-cache@v2 - name: cargo build uses: actions-rs/cargo@v1 with: command: build - args: --all-features --release --target=${{ matrix.target }} + args: --all-features --release --target=${{ matrix.target }} use-cross: ${{ matrix.cross }} - name: Compress binaries @@ -99,7 +99,7 @@ jobs: if: ${{ matrix.compress }} - name: Upload artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: ${{ matrix.target }} path: ${{ matrix.artifact_name }} @@ -116,7 +116,7 @@ jobs: if: startsWith(github.ref, 'refs/tags/v') - name: Publish - uses: svenstaro/upload-release-action@v2 + uses: svenstaro/upload-release-action@v2.7.0 with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: ${{ matrix.artifact_name }} diff --git a/Cargo.toml b/Cargo.toml index c80479f..100c61b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,45 +1,45 @@ [package] name = "quickdash" description = "A modern alternative to QuickSFV using Rust." -repository = "https://github.com/AndreVuillemot/QuickDash" +repository = "https://github.com/iamtakingithard/QuickDash" readme = "README.md" keywords = ["cli", "hash", "verify"] categories = ["authentication", "filesystem", "command-line-utilities"] license = "Apache-2.0" version = "0.6.1" -authors = ["cerda", "b1tzxd", "mjc"] -edition = "2021" +authors = ["cerda", "b1tzxd", "mjc", "taskylizard"] +edition = "2024" [dependencies] -once_cell = "1.10.0" -tabwriter = "1.2.1" -num_cpus = "1.13.1" -indicatif = { version = "0.16.2", features = ["rayon"] } -rayon = "1.5.1" -walkdir = "2.3.2" -regex = "1.5.5" -clap = { version = "3.1.8", features = ["derive"] } -crc32fast = "1.3.2" -blake2 = "0.10.4" -md-5 = "0.10.1" -blake3 = "1.3.1" -sha-1 = "0.10.0" -sha2 = "0.10.2" -sha3 = "0.10.1" -whirlpool = "0.10.1" -xxhash-rust = { version = "0.8.4", features = ["xxh32", "xxh64", "xxh3"] } +blake2 = "0.10.4" +blake3 = "1.3.1" +clap = { version = "4.4.10", features = ["derive"] } +crc32fast = "1.3.2" +indicatif = { version = "0.17.11", features = ["rayon"] } +md-5 = "0.10.1" +num_cpus = "1.13.1" +once_cell = "1.10.0" +rayon = "1.5.1" +regex = "1.5.5" +sha-1 = "0.10.0" +sha2 = "0.10.2" +sha3 = "0.10.1" +tabwriter = "1.2.1" +walkdir = "2.3.2" +whirlpool = "0.10.1" +xxhash-rust = { version = "0.8.4", features = ["xxh3", "xxh32", "xxh64"] } [profile.release] -lto = true codegen-units = 1 -debug = false +debug = false +lto = true # panic = 'abort' [[bin]] +doc = false name = "quickdash" path = "src/main.rs" test = false -doc = false [lib] name = "quickdash" diff --git a/src/algorithms.rs b/src/algorithms.rs index 79bc9a2..735d922 100644 --- a/src/algorithms.rs +++ b/src/algorithms.rs @@ -1,4 +1,4 @@ -/* Copyright [2021] [Cerda] +/* Copyright [2025] [Cerda] * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ use std::str::FromStr; -use clap::ArgEnum; +use clap::ValueEnum; /// A hashing algorithm. /// @@ -33,7 +33,7 @@ use clap::ArgEnum; /// ); /// ``` -#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, PartialOrd, Ord, ArgEnum)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, PartialOrd, Ord, ValueEnum)] pub enum Algorithm { SHA1, SHA2224, diff --git a/src/error.rs b/src/error.rs index b6fc198..ea756db 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,4 +1,4 @@ -/* Copyright [2021] [Cerda] +/* Copyright [2025] [Cerda] * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/hashing/blake2b.rs b/src/hashing/blake2b.rs index 9d4151a..e8b8587 100644 --- a/src/hashing/blake2b.rs +++ b/src/hashing/blake2b.rs @@ -1,4 +1,4 @@ -/* Copyright [2021] [Cerda] +/* Copyright [2025] [Cerda] * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/hashing/blake2s.rs b/src/hashing/blake2s.rs index 299691b..3056b99 100644 --- a/src/hashing/blake2s.rs +++ b/src/hashing/blake2s.rs @@ -1,4 +1,4 @@ -/* Copyright [2021] [Cerda] +/* Copyright [2025] [Cerda] * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/hashing/blake3.rs b/src/hashing/blake3.rs index 1e1700a..b6d17f8 100644 --- a/src/hashing/blake3.rs +++ b/src/hashing/blake3.rs @@ -1,4 +1,4 @@ -/* Copyright [2021] [Cerda] +/* Copyright [2025] [Cerda] * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/hashing/crc32.rs b/src/hashing/crc32.rs index 3718d4a..85e9d54 100644 --- a/src/hashing/crc32.rs +++ b/src/hashing/crc32.rs @@ -1,4 +1,4 @@ -/* Copyright [2021] [Cerda] +/* Copyright [2025] [Cerda] * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/hashing/md5.rs b/src/hashing/md5.rs index 6a2520f..cefa5be 100644 --- a/src/hashing/md5.rs +++ b/src/hashing/md5.rs @@ -1,4 +1,4 @@ -/* Copyright [2021] [Cerda] +/* Copyright [2025] [Cerda] * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/hashing/mod.rs b/src/hashing/mod.rs index 6c00933..af40dc2 100644 --- a/src/hashing/mod.rs +++ b/src/hashing/mod.rs @@ -1,4 +1,4 @@ -/* Copyright [2021] [Cerda] +/* Copyright [2025] [Cerda] * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/hashing/sha1.rs b/src/hashing/sha1.rs index 8999832..3e07d97 100644 --- a/src/hashing/sha1.rs +++ b/src/hashing/sha1.rs @@ -1,4 +1,4 @@ -/* Copyright [2021] [Cerda] +/* Copyright [2025] [Cerda] * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/hashing/sha2_224.rs b/src/hashing/sha2_224.rs index 76fbf2d..77ad83a 100644 --- a/src/hashing/sha2_224.rs +++ b/src/hashing/sha2_224.rs @@ -1,4 +1,4 @@ -/* Copyright [2021] [Cerda] +/* Copyright [2025] [Cerda] * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/hashing/sha2_256.rs b/src/hashing/sha2_256.rs index aa29ada..1c2aef7 100644 --- a/src/hashing/sha2_256.rs +++ b/src/hashing/sha2_256.rs @@ -1,4 +1,4 @@ -/* Copyright [2021] [Cerda] +/* Copyright [2025] [Cerda] * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/hashing/sha2_384.rs b/src/hashing/sha2_384.rs index ca6e52f..699460f 100644 --- a/src/hashing/sha2_384.rs +++ b/src/hashing/sha2_384.rs @@ -1,4 +1,4 @@ -/* Copyright [2021] [Cerda] +/* Copyright [2025] [Cerda] * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/hashing/sha2_512.rs b/src/hashing/sha2_512.rs index 6083d6f..7971140 100644 --- a/src/hashing/sha2_512.rs +++ b/src/hashing/sha2_512.rs @@ -1,4 +1,4 @@ -/* Copyright [2021] [Cerda] +/* Copyright [2025] [Cerda] * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/hashing/sha3_224.rs b/src/hashing/sha3_224.rs index a462527..2f71586 100644 --- a/src/hashing/sha3_224.rs +++ b/src/hashing/sha3_224.rs @@ -1,4 +1,4 @@ -/* Copyright [2021] [Cerda] +/* Copyright [2025] [Cerda] * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/hashing/sha3_256.rs b/src/hashing/sha3_256.rs index 3b16e83..b6a8316 100644 --- a/src/hashing/sha3_256.rs +++ b/src/hashing/sha3_256.rs @@ -1,4 +1,4 @@ -/* Copyright [2021] [Cerda] +/* Copyright [2025] [Cerda] * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/hashing/sha3_384.rs b/src/hashing/sha3_384.rs index c3fb400..7427f14 100644 --- a/src/hashing/sha3_384.rs +++ b/src/hashing/sha3_384.rs @@ -1,4 +1,4 @@ -/* Copyright [2021] [Cerda] +/* Copyright [2025] [Cerda] * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/hashing/sha3_512.rs b/src/hashing/sha3_512.rs index c8e3c9f..1bc5326 100644 --- a/src/hashing/sha3_512.rs +++ b/src/hashing/sha3_512.rs @@ -1,4 +1,4 @@ -/* Copyright [2021] [Cerda] +/* Copyright [2025] [Cerda] * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/hashing/whirlpool.rs b/src/hashing/whirlpool.rs index 15d58b5..1a746a8 100644 --- a/src/hashing/whirlpool.rs +++ b/src/hashing/whirlpool.rs @@ -1,4 +1,4 @@ -/* Copyright [2021] [Cerda] +/* Copyright [2025] [Cerda] * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/hashing/xxh3.rs b/src/hashing/xxh3.rs index 73742e9..6b40616 100644 --- a/src/hashing/xxh3.rs +++ b/src/hashing/xxh3.rs @@ -1,4 +1,4 @@ -/* Copyright [2021] [Cerda] +/* Copyright [2025] [Cerda] * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/hashing/xxh32.rs b/src/hashing/xxh32.rs index 0f63662..1dbca29 100644 --- a/src/hashing/xxh32.rs +++ b/src/hashing/xxh32.rs @@ -1,4 +1,4 @@ -/* Copyright [2021] [Cerda] +/* Copyright [2025] [Cerda] * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/hashing/xxh64.rs b/src/hashing/xxh64.rs index 21be8c7..089260c 100644 --- a/src/hashing/xxh64.rs +++ b/src/hashing/xxh64.rs @@ -1,4 +1,4 @@ -/* Copyright [2021] [Cerda] +/* Copyright [2025] [Cerda] * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/lib.rs b/src/lib.rs index c11505e..3a7d9ee 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,4 @@ -/* Copyright [2021] [Cerda] +/* Copyright [2025] [Cerda] * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -143,7 +143,7 @@ //! up to `jobs` times. //! //! No/empty value: # of CPU threads. value = 0: maximum, of u8 (255) -//! +//! //! ``` //! //! [DIRECTORY] @@ -188,20 +188,7 @@ //! E84E380AEBDA3D98E96267201D61784C3D6FFB128C4D669E6C1D994C7D7BF32B Cross.toml //! ``` -#![deny( - anonymous_parameters, - clippy::all, - const_err, - illegal_floating_point_literal_pattern, - late_bound_lifetime_arguments, - path_statements, - patterns_in_fns_without_body, - rust_2018_idioms, - trivial_casts, - trivial_numeric_casts, - unsafe_code, - unused_extern_crates -)] +#![deny(unsafe_code)] #![allow(clippy::tabs_in_doc_comments)] mod algorithms; diff --git a/src/main.rs b/src/main.rs index 2023f29..8e666ce 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,4 @@ -/* Copyright [2021] [Cerda] +/* Copyright [2025] [Cerda] * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,7 @@ const BANNER: [&str; 13] = [ " ░ ░ ░░░ ░ ░ ▒ ░░ ░ ░░ ░ ░ ░ ░ ░ ▒ ░ ░ ░ ░ ░░ ░", " ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░", "", - "Made with <3 by Cerda. Repo: https://github.com/AndreVuillemot160/QuickDash/", + "Made with <3 by Cerda. Repo: https://github.com/iamtakingithard/QuickDash", "", ]; diff --git a/src/operations/compare.rs b/src/operations/compare.rs index c0c7f37..2b2c7c4 100644 --- a/src/operations/compare.rs +++ b/src/operations/compare.rs @@ -1,4 +1,4 @@ -/* Copyright [2021] [Cerda] +/* Copyright [2025] [Cerda] * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/operations/mod.rs b/src/operations/mod.rs index 8523a5b..b90a3c6 100644 --- a/src/operations/mod.rs +++ b/src/operations/mod.rs @@ -1,4 +1,4 @@ -/* Copyright [2021] [Cerda] +/* Copyright [2025] [Cerda] * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,13 +30,14 @@ use std::{ fs::File, io::{BufRead, BufReader, Write}, path::Path, + time::Duration, }; use indicatif::{ParallelProgressIterator, ProgressBar, ProgressStyle}; use once_cell::sync::Lazy; use rayon::{ - iter::{IntoParallelRefIterator, ParallelIterator}, ThreadPoolBuilder, + iter::{IntoParallelRefIterator, ParallelIterator}, }; use regex::Regex; use tabwriter::TabWriter; @@ -44,10 +45,8 @@ use walkdir::{DirEntry, WalkDir}; pub use self::{compare::*, write::*}; use crate::{ - hash_file, + Algorithm, Error, hash_file, utilities::{mul_str, relative_name}, - Algorithm, - Error, }; static SPINNER_STRINGS: [&str; 10] = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"]; @@ -69,6 +68,7 @@ pub fn create_hashes( let pb_style = ProgressStyle::default_bar() .template("{prefix:.bold.dim} {spinner} {wide_bar} {pos:>7}/{len:7} ETA: {eta} - {msg}") + .unwrap() .tick_strings(&SPINNER_STRINGS); let pb = ProgressBar::new_spinner(); @@ -81,7 +81,7 @@ pub fn create_hashes( let mut hashes = BTreeMap::new(); - pb.enable_steady_tick(80); + pb.enable_steady_tick(Duration::from_millis(80)); pb.set_message("Finding files to hash..."); let mut files: Vec = walkdir .into_iter() diff --git a/src/operations/write.rs b/src/operations/write.rs index 9d2f505..89774e8 100644 --- a/src/operations/write.rs +++ b/src/operations/write.rs @@ -1,4 +1,4 @@ -/* Copyright [2021] [Cerda] +/* Copyright [2025] [Cerda] * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,7 @@ use std::io::Write; use super::{CompareError, CompareFileResult, CompareResult}; -use crate::{utilities::mul_str, Error}; +use crate::{Error, utilities::mul_str}; /// Write hash comparison results to the output streams in a human-consumable /// format diff --git a/src/options.rs b/src/options.rs index df62820..b94acd2 100644 --- a/src/options.rs +++ b/src/options.rs @@ -1,4 +1,4 @@ -/* Copyright [2021] [Cerda] +/* Copyright [2025] [Cerda] * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,7 @@ use clap::{Parser, Subcommand}; use crate::Algorithm; #[derive(Parser)] -#[clap( +#[command( name = "QuickDash", version, about, @@ -28,43 +28,45 @@ use crate::Algorithm; )] pub struct Commands { /// Hashing algorithm to use. - #[clap(arg_enum, short, long, default_value = "blake3")] + #[arg(value_enum, short, long, default_value = "blake3")] pub algorithm: Algorithm, /// Max recursion depth. Infinite if None. Default: `0` - #[clap(short, long)] + #[arg(short, long)] pub depth: Option, /// Whether to recurse down symlinks. Default: `true` - #[clap(long)] + #[arg(long)] pub follow_symlinks: bool, /// Files/directories to ignore. Default: none - #[clap(short, long)] + #[arg(short, long)] pub ignored_files: Vec, /// # of threads used for hashing. - #[clap(short, long, default_value_t = 0)] + #[arg(short, long, default_value_t = 0)] pub jobs: usize, /// Whether to verify or create hashes. Default: Verify - #[clap(subcommand)] + #[command(subcommand)] pub command: Mode, } #[derive(Subcommand)] pub enum Mode { + /// Create a hash file Create { /// Directory to hash. Default: current directory - #[clap(default_value = ".")] + #[arg(default_value = ".")] path: PathBuf, /// Output filename. Default: `directory_name.hash"` - #[clap(long)] + #[arg(long)] file: Option, - #[clap(short, long)] + #[arg(short, long)] force: bool, }, + /// Verify a hash file Verify { /// Directory to verify. Default: current directory - #[clap(default_value = ".")] + #[arg(default_value = ".")] path: PathBuf, - /// Input filename. Default: `directory_name.hash"` - #[clap(long)] + /// Input filename. Default: `directory_name.hash` + #[arg(long)] file: Option, }, } diff --git a/src/utilities.rs b/src/utilities.rs index 9b9cb17..e3d3ab8 100644 --- a/src/utilities.rs +++ b/src/utilities.rs @@ -1,4 +1,4 @@ -/* Copyright [2021] [Cerda] +/* Copyright [2025] [Cerda] * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.