diff --git a/CHANGELOG.md b/CHANGELOG.md index 65af2a0f..73064cda 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## Unreleased ### Fixed +- Fixed display style option triggering `ArgumentConflict` when using quiet option. [(#288)](https://github.com/Kampfkarren/selene/issues/288) - `bad_string_escape` now correctly handles escapes of the shape `\1a` (one or two numbers followed by a hex digit). (#292)[https://github.com/Kampfkarren/selene/issues/292] ## [0.14.0] - 2021-07-07 diff --git a/selene/src/main.rs b/selene/src/main.rs index f2bd29a8..af70523a 100644 --- a/selene/src/main.rs +++ b/selene/src/main.rs @@ -111,7 +111,7 @@ fn emit_codespan( ..Default::default() }; - if opts.display_style == opts::DisplayStyle::Json { + if let Some(opts::DisplayStyle::Json) = opts.display_style { writeln!( writer, "{}", diff --git a/selene/src/opts.rs b/selene/src/opts.rs index cf626d8e..6b3c61db 100644 --- a/selene/src/opts.rs +++ b/selene/src/opts.rs @@ -25,14 +25,14 @@ pub struct Options { pub num_threads: usize, /// Sets the display method + // default_value is not used here since it triggers ArgumentConflict with quiet option #[structopt( long, possible_values = &DisplayStyle::variants(), case_insensitive = true, conflicts_with = "quiet", - default_value = "rich", )] - pub display_style: DisplayStyle, + pub display_style: Option, /// Display only the necessary information. /// Equivalent to --display-style="quiet" @@ -64,7 +64,10 @@ pub struct Options { impl Options { pub fn quiet(&self) -> bool { - self.quiet || self.display_style == DisplayStyle::Quiet + match self.display_style { + Some(display_style) => display_style == DisplayStyle::Quiet, + None => self.quiet, + } } }