From 0c5dbc7cc37ec7a414df979f3ba4bc730e577bf2 Mon Sep 17 00:00:00 2001 From: Hatter Jiang Date: Sat, 23 Dec 2023 16:25:26 +0800 Subject: [PATCH] feat: code style --- src/cmd_decrypt.rs | 6 +++--- src/cmd_encrypt.rs | 6 +++--- src/util.rs | 5 +---- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/cmd_decrypt.rs b/src/cmd_decrypt.rs index 9e9d56b..1cef335 100644 --- a/src/cmd_decrypt.rs +++ b/src/cmd_decrypt.rs @@ -48,9 +48,6 @@ use crate::wrap_key::WrapKey; #[derive(Debug, Args)] pub struct CmdDecrypt { - /// Files need to be decrypted - pub paths: Vec, - /// PGP or PIV PIN #[arg(long, short = 'p')] pub pin: Option, @@ -94,6 +91,9 @@ pub struct CmdDecrypt { /// Digest algorithm (sha1, sha256[default], sha384, sha512 ...) #[arg(long, short = 'A')] pub digest_algorithm: Option, + + /// Files need to be decrypted + pub paths: Vec, } impl Drop for CmdDecrypt { diff --git a/src/cmd_encrypt.rs b/src/cmd_encrypt.rs index de921a7..31ee92e 100644 --- a/src/cmd_encrypt.rs +++ b/src/cmd_encrypt.rs @@ -34,9 +34,6 @@ use crate::wrap_key::{WrapKey, WrapKeyHeader}; #[derive(Debug, Args)] pub struct CmdEncrypt { - /// Files need to be decrypted - pub paths: Vec, - /// Plaintext comment #[arg(long, short = 'c')] pub comment: Option, @@ -76,6 +73,9 @@ pub struct CmdEncrypt { /// Encryption algorithm (AES/GCM, CHACHA20/POLY1305 or AES, CHACHA20, default AES/GCM) #[arg(long, short = 'A')] pub encryption_algorithm: Option, + + /// Files need to be decrypted + pub paths: Vec, } pub fn encrypt(cmd_encrypt: CmdEncrypt) -> XResult<()> { diff --git a/src/util.rs b/src/util.rs index 71d9df0..c3de44d 100644 --- a/src/util.rs +++ b/src/util.rs @@ -176,10 +176,7 @@ pub fn read_number(hint: &str, from: usize, to: usize) -> usize { } pub fn get_user_agent() -> String { - format!("TinyEncrypt-rs v{}@{}-{}", - env!("CARGO_PKG_VERSION"), - get_os(), get_arch(), - ) + format!("TinyEncrypt-rs v{}@{}-{}", env!("CARGO_PKG_VERSION"), get_os(), get_arch()) } pub fn get_os() -> String {