feat: v1.7.13

This commit is contained in:
2024-06-16 10:37:40 +08:00
parent f74a81d4ca
commit 598dbc38c7
4 changed files with 7 additions and 5 deletions

View File

@@ -214,7 +214,7 @@ pub fn read_number(hint: &str, from: usize, to: usize) -> usize {
}
pub fn is_tiny_enc_file(filename: &str) -> bool {
return filename.ends_with(TINY_ENC_FILE_EXT) || filename.ends_with(TINY_ENC_PEM_FILE_EXT);
filename.ends_with(TINY_ENC_FILE_EXT) || filename.ends_with(TINY_ENC_PEM_FILE_EXT)
}
pub fn get_user_agent() -> String {
@@ -291,9 +291,11 @@ pub fn ratio(numerator: u64, denominator: u64) -> String {
format!("{:.2}", r as f64 / 100f64)
}
#[allow(clippy::declare_interior_mutable_const)]
const CTRL_C_SET: AtomicBool = AtomicBool::new(false);
pub fn register_ctrlc() {
#[allow(clippy::borrow_interior_mutable_const)]
if !CTRL_C_SET.load(Ordering::SeqCst) {
CTRL_C_SET.store(true, Ordering::SeqCst);
let _ = ctrlc::set_handler(move || {

View File

@@ -51,8 +51,8 @@ pub fn gpg_encrypt(key_id: &str, message: &[u8]) -> XResult<String> {
let gpg_encrypt_result = cmd
.args([
"-e", "-a", "--no-comment",
"-r", &key_id,
"--comment", &format!("tiny-encrypt-v{} - {}", env!("CARGO_PKG_VERSION"), &key_id)
"-r", key_id,
"--comment", &format!("tiny-encrypt-v{} - {}", env!("CARGO_PKG_VERSION"), key_id)
])
.stdin(Stdio::piped())
.stdout(Stdio::piped())