feat: v0.7.1, compiles without smart card(encrypt only)
This commit is contained in:
@@ -7,10 +7,15 @@ use crate::util;
|
||||
pub struct CmdVersion {}
|
||||
|
||||
pub fn version(_cmd_version: CmdVersion) -> XResult<()> {
|
||||
let mut features: Vec<&str> = vec![];
|
||||
#[cfg(feature = "smartcard")]
|
||||
features.push("smartcard");
|
||||
if features.is_empty() { features.push("-"); }
|
||||
println!(
|
||||
"User-Agent: {}\n{}",
|
||||
"User-Agent: {} [ with features: {} ]\n{}",
|
||||
util::get_user_agent(),
|
||||
env!("CARGO_PKG_DESCRIPTION"),
|
||||
features.join(", "),
|
||||
env!("CARGO_PKG_DESCRIPTION")
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
@@ -1,7 +1,10 @@
|
||||
pub use cmd_config::CmdConfig;
|
||||
pub use cmd_config::config;
|
||||
#[cfg(feature = "smartcard")]
|
||||
pub use cmd_decrypt::CmdDecrypt;
|
||||
#[cfg(feature = "smartcard")]
|
||||
pub use cmd_decrypt::decrypt;
|
||||
#[cfg(feature = "smartcard")]
|
||||
pub use cmd_decrypt::decrypt_single;
|
||||
pub use cmd_directdecrypt::CmdDirectDecrypt;
|
||||
pub use cmd_directdecrypt::direct_decrypt;
|
||||
@@ -20,7 +23,9 @@ mod util;
|
||||
mod util_env;
|
||||
mod util_digest;
|
||||
mod util_progress;
|
||||
#[cfg(feature = "smartcard")]
|
||||
mod util_piv;
|
||||
#[cfg(feature = "smartcard")]
|
||||
mod util_pgp;
|
||||
mod util_p256;
|
||||
mod util_p384;
|
||||
@@ -38,6 +43,7 @@ mod util_enc_file;
|
||||
mod cmd_version;
|
||||
mod cmd_config;
|
||||
mod cmd_info;
|
||||
#[cfg(feature = "smartcard")]
|
||||
mod cmd_decrypt;
|
||||
mod cmd_encrypt;
|
||||
mod cmd_directdecrypt;
|
||||
|
||||
@@ -3,7 +3,9 @@ extern crate core;
|
||||
use clap::{Parser, Subcommand};
|
||||
use rust_util::XResult;
|
||||
|
||||
use tiny_encrypt::{CmdConfig, CmdDecrypt, CmdDirectDecrypt, CmdEncrypt, CmdInfo, CmdVersion};
|
||||
use tiny_encrypt::{CmdConfig, CmdDirectDecrypt, CmdEncrypt, CmdInfo, CmdVersion};
|
||||
#[cfg(feature = "smartcard")]
|
||||
use tiny_encrypt::CmdDecrypt;
|
||||
|
||||
#[derive(Debug, Parser)]
|
||||
#[command(name = "tiny-encrypt-rs")]
|
||||
@@ -18,6 +20,7 @@ enum Commands {
|
||||
/// Encrypt file(s)
|
||||
#[command(arg_required_else_help = true, short_flag = 'e')]
|
||||
Encrypt(CmdEncrypt),
|
||||
#[cfg(feature = "smartcard")]
|
||||
/// Decrypt file(s)
|
||||
#[command(arg_required_else_help = true, short_flag = 'd')]
|
||||
Decrypt(CmdDecrypt),
|
||||
@@ -39,6 +42,7 @@ fn main() -> XResult<()> {
|
||||
let args = Cli::parse();
|
||||
match args.command {
|
||||
Commands::Encrypt(cmd_encrypt) => tiny_encrypt::encrypt(cmd_encrypt),
|
||||
#[cfg(feature = "smartcard")]
|
||||
Commands::Decrypt(cmd_decrypt) => tiny_encrypt::decrypt(cmd_decrypt),
|
||||
Commands::DirectDecrypt(cmd_direct_decrypt) => tiny_encrypt::direct_decrypt(cmd_direct_decrypt),
|
||||
Commands::Info(cmd_info) => tiny_encrypt::info(cmd_info),
|
||||
|
||||
Reference in New Issue
Block a user