diff options
Diffstat (limited to 'src/utils')
| -rw-r--r-- | src/utils/mod.rs | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/utils/mod.rs b/src/utils/mod.rs index 40967ab..35f41a2 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -22,7 +22,7 @@ use anyhow::{Context, Result}; use fancy_regex::Regex; use is_terminal::IsTerminal; use lazy_static::lazy_static; -use std::{env, path::PathBuf}; +use std::{env, path::PathBuf, process}; lazy_static! { pub static ref CODE_BLOCK_RE: Regex = Regex::new(r"(?ms)```\w*(.*)```").unwrap(); @@ -42,14 +42,6 @@ pub fn get_env_name(key: &str) -> String { ) } -pub fn get_env_bool(key: &str) -> bool { - if let Ok(value) = env::var(get_env_name(key)) { - value == "1" || value == "true" - } else { - false - } -} - pub fn tokenize(text: &str) -> Vec<&str> { if text.is_ascii() { text.split_inclusive(|c: char| c.is_ascii_whitespace()) @@ -158,8 +150,9 @@ pub fn dimmed_text(input: &str) -> String { pub fn temp_file(prefix: &str, suffix: &str) -> PathBuf { env::temp_dir().join(format!( - "{}{prefix}{}{suffix}", + "{}-{}{prefix}{}{suffix}", env!("CARGO_CRATE_NAME").to_lowercase(), + process::id(), uuid::Uuid::new_v4() )) } |
