feat: fix compile issue, code style

This commit is contained in:
2023-12-23 15:53:26 +08:00
parent a3d101a405
commit 171cd2d2a4
5 changed files with 32 additions and 2 deletions

View File

@@ -38,6 +38,7 @@ use crate::util_digest::DigestWrite;
use crate::util_keychainkey;
#[cfg(feature = "macos")]
use crate::util_keychainstatic;
#[cfg(feature = "macos")]
use crate::util_keychainstatic::KeychainKey;
use crate::util_progress::Progress;
use crate::wrap_key::WrapKey;
@@ -46,36 +47,47 @@ use crate::wrap_key::WrapKey;
pub struct CmdDecrypt {
/// Files need to be decrypted
pub paths: Vec<PathBuf>,
/// PGP or PIV PIN
#[arg(long, short = 'p')]
pub pin: Option<String>,
/// KeyID
#[arg(long, short = 'k')]
pub key_id: Option<String>,
/// PIV slot
#[arg(long, short = 's')]
pub slot: Option<String>,
/// Remove source file
#[arg(long, short = 'R')]
pub remove_file: bool,
/// Skip decrypt file
#[arg(long, short = 'S')]
pub skip_decrypt_file: bool,
/// Direct print to the console, file must less than 10K
#[arg(long, short = 'P')]
pub direct_print: bool,
/// Split std out and std err
#[arg(long)]
pub split_print: bool,
/// Digest file
#[arg(long, short = 'D')]
pub digest_file: bool,
/// Edit file
#[arg(long, short = 'E')]
pub edit_file: bool,
/// Readonly mode
#[arg(long)]
pub readonly: bool,
/// Digest algorithm (sha1, sha256[default], sha384, sha512 ...)
#[arg(long, short = 'A')]
pub digest_algorithm: Option<String>,

View File

@@ -17,12 +17,15 @@ pub struct CmdDirectDecrypt {
/// File input
#[arg(long, short = 'i')]
pub file_in: PathBuf,
/// File output
#[arg(long, short = 'o')]
pub file_out: PathBuf,
/// Remove source file
#[arg(long, short = 'R')]
pub remove_file: bool,
/// Key in HEX (32 bytes)
#[arg(long, short = 'k')]
pub key: String,

View File

@@ -28,33 +28,43 @@ use crate::wrap_key::{WrapKey, WrapKeyHeader};
pub struct CmdEncrypt {
/// Files need to be decrypted
pub paths: Vec<PathBuf>,
/// Plaintext comment
#[arg(long, short = 'c')]
pub comment: Option<String>,
/// Encrypted comment
#[arg(long, short = 'C')]
pub encrypted_comment: Option<String>,
/// Encryption profile (use default when --key-filter is assigned)
#[arg(long, short = 'p')]
pub profile: Option<String>,
/// Encryption key filter (key_id or type:TYPE(e.g. ecdh, pgp, ecdh-p384, pgp-ed25519), multiple joined by ',', ALL for all)
#[arg(long, short = 'k')]
pub key_filter: Option<String>,
/// Compress before encrypt
#[arg(long, short = 'x')]
pub compress: bool,
/// Compress level (from 0[none], 1[fast] .. 6[default] .. to 9[best])
#[arg(long, short = 'L')]
pub compress_level: Option<u32>,
/// Remove source file
#[arg(long, short = 'R')]
pub remove_file: bool,
/// Create file (create a empty encrypted file)
#[arg(long, short = 'a')]
pub create: bool,
/// Disable compress meta
#[arg(long)]
pub disable_compress_meta: bool,
/// Encryption algorithm (AES/GCM, CHACHA20/POLY1305 or AES, CHACHA20, default AES/GCM)
#[arg(long, short = 'A')]
pub encryption_algorithm: Option<String>,

View File

@@ -21,14 +21,18 @@ pub struct CmdExecEnv {
/// PGP or PIV PIN
#[arg(long, short = 'p')]
pub pin: Option<String>,
/// KeyID
#[arg(long, short = 'k')]
pub key_id: Option<String>,
/// PIV slot
#[arg(long, short = 's')]
pub slot: Option<String>,
/// Tiny encrypt file name
pub file_name: String,
/// Command and arguments
pub command_arguments: Vec<String>,
}

View File

@@ -18,11 +18,12 @@ use crate::wrap_key::WrapKey;
#[derive(Debug, Args)]
pub struct CmdInfo {
/// File
pub paths: Vec<PathBuf>,
/// Show raw meta
#[arg(long, short = 'M', default_value_t = false)]
pub raw_meta: bool,
/// File
pub paths: Vec<PathBuf>,
}
pub fn info(cmd_info: CmdInfo) -> XResult<()> {