Skip to content

Commit

Permalink
- Fixed display style option triggering ArgumentConflict when usin…
Browse files Browse the repository at this point in the history
…g quiet option. [(#288)](#288) (#291)

Co-authored-by: boyned//Kampfkarren <boynedmaster@gmail.com>
  • Loading branch information
soutenu and Kampfkarren authored Sep 23, 2021
1 parent 38ff18e commit e182696
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion selene/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
"{}",
Expand Down
9 changes: 6 additions & 3 deletions selene/src/opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<DisplayStyle>,

/// Display only the necessary information.
/// Equivalent to --display-style="quiet"
Expand Down Expand Up @@ -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,
}
}
}

Expand Down

0 comments on commit e182696

Please sign in to comment.