Skip to content

Commit

Permalink
fix: build/tests
Browse files Browse the repository at this point in the history
  • Loading branch information
PThorpe92 committed Oct 31, 2023
1 parent 6391c3b commit c7b7101
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 20 deletions.
35 changes: 16 additions & 19 deletions src/options/file_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,29 +88,26 @@ impl ShowIcons {

impl QuoteStyle {
pub fn deduce(matches: &MatchedFlags<'_>) -> Result<Self, OptionsError> {
if let Ok(env) = std::env::var("EZA_QUOTE_STYLE") {
match env.as_str() {
"always" => return Ok(Self::Always),
"never" => return Ok(Self::Never),
&_ => return Ok(Self::Auto),
};
} else if matches.get(&flags::QUOTES)?.is_some() {
// prioritize the command line flag over the environment variable
let word = matches.get(&flags::QUOTES)?.unwrap();
match word.to_str() {
Some("always") => return Ok(Self::Always),
Some("never") => return Ok(Self::Never),
Some("auto") => return Ok(Self::Auto),
None => return Err(OptionsError::BadArgument(&flags::QUOTES, word.into())),
_ => return Err(OptionsError::BadArgument(&flags::QUOTES, word.into())),
}
} else {
return Ok(Self::Auto);
let env = std::env::var("EZA_QUOTING_STYLE");
let env = env.unwrap_or_else(|_| "auto".to_string());
let env = match env.to_ascii_lowercase().as_str() {
"always" => Self::Always,
"never" => Self::Never,
_ => Self::Auto,
};
if matches.get(&flags::QUOTES)?.is_none() {
Ok(env)
} else {
match matches.get(&flags::QUOTES)?.unwrap() {
word if word.to_str() == Some("always") => Ok(Self::Always),
word if word.to_str() == Some("never") => Ok(Self::Never),
word if word.to_str() == Some("auto") => Ok(Self::Auto),
_ => Err(OptionsError::BadArgument(&flags::QUOTES, "auto".into())),
}
}
}
}


impl EmbedHyperlinks {
fn deduce(matches: &MatchedFlags<'_>) -> Result<Self, OptionsError> {
let flagged = matches.has(&flags::HYPERLINK)?;
Expand Down
2 changes: 1 addition & 1 deletion src/output/file_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ pub enum EmbedHyperlinks {
pub enum QuoteStyle {
/// Don't ever quote file names.
Never,
/// Quote file names that contain spaces
/// Quote file names that contain spaces (default)
Auto,
/// Always quote file names.
Always,
Expand Down

0 comments on commit c7b7101

Please sign in to comment.