feat: fix compile issue, code style
This commit is contained in:
@@ -38,6 +38,7 @@ use crate::util_digest::DigestWrite;
|
|||||||
use crate::util_keychainkey;
|
use crate::util_keychainkey;
|
||||||
#[cfg(feature = "macos")]
|
#[cfg(feature = "macos")]
|
||||||
use crate::util_keychainstatic;
|
use crate::util_keychainstatic;
|
||||||
|
#[cfg(feature = "macos")]
|
||||||
use crate::util_keychainstatic::KeychainKey;
|
use crate::util_keychainstatic::KeychainKey;
|
||||||
use crate::util_progress::Progress;
|
use crate::util_progress::Progress;
|
||||||
use crate::wrap_key::WrapKey;
|
use crate::wrap_key::WrapKey;
|
||||||
@@ -46,36 +47,47 @@ use crate::wrap_key::WrapKey;
|
|||||||
pub struct CmdDecrypt {
|
pub struct CmdDecrypt {
|
||||||
/// Files need to be decrypted
|
/// Files need to be decrypted
|
||||||
pub paths: Vec<PathBuf>,
|
pub paths: Vec<PathBuf>,
|
||||||
|
|
||||||
/// PGP or PIV PIN
|
/// PGP or PIV PIN
|
||||||
#[arg(long, short = 'p')]
|
#[arg(long, short = 'p')]
|
||||||
pub pin: Option<String>,
|
pub pin: Option<String>,
|
||||||
|
|
||||||
/// KeyID
|
/// KeyID
|
||||||
#[arg(long, short = 'k')]
|
#[arg(long, short = 'k')]
|
||||||
pub key_id: Option<String>,
|
pub key_id: Option<String>,
|
||||||
|
|
||||||
/// PIV slot
|
/// PIV slot
|
||||||
#[arg(long, short = 's')]
|
#[arg(long, short = 's')]
|
||||||
pub slot: Option<String>,
|
pub slot: Option<String>,
|
||||||
|
|
||||||
/// Remove source file
|
/// Remove source file
|
||||||
#[arg(long, short = 'R')]
|
#[arg(long, short = 'R')]
|
||||||
pub remove_file: bool,
|
pub remove_file: bool,
|
||||||
|
|
||||||
/// Skip decrypt file
|
/// Skip decrypt file
|
||||||
#[arg(long, short = 'S')]
|
#[arg(long, short = 'S')]
|
||||||
pub skip_decrypt_file: bool,
|
pub skip_decrypt_file: bool,
|
||||||
|
|
||||||
/// Direct print to the console, file must less than 10K
|
/// Direct print to the console, file must less than 10K
|
||||||
#[arg(long, short = 'P')]
|
#[arg(long, short = 'P')]
|
||||||
pub direct_print: bool,
|
pub direct_print: bool,
|
||||||
|
|
||||||
/// Split std out and std err
|
/// Split std out and std err
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
pub split_print: bool,
|
pub split_print: bool,
|
||||||
|
|
||||||
/// Digest file
|
/// Digest file
|
||||||
#[arg(long, short = 'D')]
|
#[arg(long, short = 'D')]
|
||||||
pub digest_file: bool,
|
pub digest_file: bool,
|
||||||
|
|
||||||
/// Edit file
|
/// Edit file
|
||||||
#[arg(long, short = 'E')]
|
#[arg(long, short = 'E')]
|
||||||
pub edit_file: bool,
|
pub edit_file: bool,
|
||||||
|
|
||||||
/// Readonly mode
|
/// Readonly mode
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
pub readonly: bool,
|
pub readonly: bool,
|
||||||
|
|
||||||
/// Digest algorithm (sha1, sha256[default], sha384, sha512 ...)
|
/// Digest algorithm (sha1, sha256[default], sha384, sha512 ...)
|
||||||
#[arg(long, short = 'A')]
|
#[arg(long, short = 'A')]
|
||||||
pub digest_algorithm: Option<String>,
|
pub digest_algorithm: Option<String>,
|
||||||
|
|||||||
@@ -17,12 +17,15 @@ pub struct CmdDirectDecrypt {
|
|||||||
/// File input
|
/// File input
|
||||||
#[arg(long, short = 'i')]
|
#[arg(long, short = 'i')]
|
||||||
pub file_in: PathBuf,
|
pub file_in: PathBuf,
|
||||||
|
|
||||||
/// File output
|
/// File output
|
||||||
#[arg(long, short = 'o')]
|
#[arg(long, short = 'o')]
|
||||||
pub file_out: PathBuf,
|
pub file_out: PathBuf,
|
||||||
|
|
||||||
/// Remove source file
|
/// Remove source file
|
||||||
#[arg(long, short = 'R')]
|
#[arg(long, short = 'R')]
|
||||||
pub remove_file: bool,
|
pub remove_file: bool,
|
||||||
|
|
||||||
/// Key in HEX (32 bytes)
|
/// Key in HEX (32 bytes)
|
||||||
#[arg(long, short = 'k')]
|
#[arg(long, short = 'k')]
|
||||||
pub key: String,
|
pub key: String,
|
||||||
|
|||||||
@@ -28,33 +28,43 @@ use crate::wrap_key::{WrapKey, WrapKeyHeader};
|
|||||||
pub struct CmdEncrypt {
|
pub struct CmdEncrypt {
|
||||||
/// Files need to be decrypted
|
/// Files need to be decrypted
|
||||||
pub paths: Vec<PathBuf>,
|
pub paths: Vec<PathBuf>,
|
||||||
|
|
||||||
/// Plaintext comment
|
/// Plaintext comment
|
||||||
#[arg(long, short = 'c')]
|
#[arg(long, short = 'c')]
|
||||||
pub comment: Option<String>,
|
pub comment: Option<String>,
|
||||||
|
|
||||||
/// Encrypted comment
|
/// Encrypted comment
|
||||||
#[arg(long, short = 'C')]
|
#[arg(long, short = 'C')]
|
||||||
pub encrypted_comment: Option<String>,
|
pub encrypted_comment: Option<String>,
|
||||||
|
|
||||||
/// Encryption profile (use default when --key-filter is assigned)
|
/// Encryption profile (use default when --key-filter is assigned)
|
||||||
#[arg(long, short = 'p')]
|
#[arg(long, short = 'p')]
|
||||||
pub profile: Option<String>,
|
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)
|
/// 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')]
|
#[arg(long, short = 'k')]
|
||||||
pub key_filter: Option<String>,
|
pub key_filter: Option<String>,
|
||||||
|
|
||||||
/// Compress before encrypt
|
/// Compress before encrypt
|
||||||
#[arg(long, short = 'x')]
|
#[arg(long, short = 'x')]
|
||||||
pub compress: bool,
|
pub compress: bool,
|
||||||
|
|
||||||
/// Compress level (from 0[none], 1[fast] .. 6[default] .. to 9[best])
|
/// Compress level (from 0[none], 1[fast] .. 6[default] .. to 9[best])
|
||||||
#[arg(long, short = 'L')]
|
#[arg(long, short = 'L')]
|
||||||
pub compress_level: Option<u32>,
|
pub compress_level: Option<u32>,
|
||||||
|
|
||||||
/// Remove source file
|
/// Remove source file
|
||||||
#[arg(long, short = 'R')]
|
#[arg(long, short = 'R')]
|
||||||
pub remove_file: bool,
|
pub remove_file: bool,
|
||||||
|
|
||||||
/// Create file (create a empty encrypted file)
|
/// Create file (create a empty encrypted file)
|
||||||
#[arg(long, short = 'a')]
|
#[arg(long, short = 'a')]
|
||||||
pub create: bool,
|
pub create: bool,
|
||||||
|
|
||||||
/// Disable compress meta
|
/// Disable compress meta
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
pub disable_compress_meta: bool,
|
pub disable_compress_meta: bool,
|
||||||
|
|
||||||
/// Encryption algorithm (AES/GCM, CHACHA20/POLY1305 or AES, CHACHA20, default AES/GCM)
|
/// Encryption algorithm (AES/GCM, CHACHA20/POLY1305 or AES, CHACHA20, default AES/GCM)
|
||||||
#[arg(long, short = 'A')]
|
#[arg(long, short = 'A')]
|
||||||
pub encryption_algorithm: Option<String>,
|
pub encryption_algorithm: Option<String>,
|
||||||
|
|||||||
@@ -21,14 +21,18 @@ pub struct CmdExecEnv {
|
|||||||
/// PGP or PIV PIN
|
/// PGP or PIV PIN
|
||||||
#[arg(long, short = 'p')]
|
#[arg(long, short = 'p')]
|
||||||
pub pin: Option<String>,
|
pub pin: Option<String>,
|
||||||
|
|
||||||
/// KeyID
|
/// KeyID
|
||||||
#[arg(long, short = 'k')]
|
#[arg(long, short = 'k')]
|
||||||
pub key_id: Option<String>,
|
pub key_id: Option<String>,
|
||||||
|
|
||||||
/// PIV slot
|
/// PIV slot
|
||||||
#[arg(long, short = 's')]
|
#[arg(long, short = 's')]
|
||||||
pub slot: Option<String>,
|
pub slot: Option<String>,
|
||||||
|
|
||||||
/// Tiny encrypt file name
|
/// Tiny encrypt file name
|
||||||
pub file_name: String,
|
pub file_name: String,
|
||||||
|
|
||||||
/// Command and arguments
|
/// Command and arguments
|
||||||
pub command_arguments: Vec<String>,
|
pub command_arguments: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,11 +18,12 @@ use crate::wrap_key::WrapKey;
|
|||||||
|
|
||||||
#[derive(Debug, Args)]
|
#[derive(Debug, Args)]
|
||||||
pub struct CmdInfo {
|
pub struct CmdInfo {
|
||||||
/// File
|
|
||||||
pub paths: Vec<PathBuf>,
|
|
||||||
/// Show raw meta
|
/// Show raw meta
|
||||||
#[arg(long, short = 'M', default_value_t = false)]
|
#[arg(long, short = 'M', default_value_t = false)]
|
||||||
pub raw_meta: bool,
|
pub raw_meta: bool,
|
||||||
|
|
||||||
|
/// File
|
||||||
|
pub paths: Vec<PathBuf>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn info(cmd_info: CmdInfo) -> XResult<()> {
|
pub fn info(cmd_info: CmdInfo) -> XResult<()> {
|
||||||
|
|||||||
Reference in New Issue
Block a user