Skip to content

Commit

Permalink
bug: fix using 'none' for legend position in configs
Browse files Browse the repository at this point in the history
  • Loading branch information
ClementTsang committed Sep 12, 2024
1 parent eaa5623 commit 2f8aec7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/canvas/components/tui_widget/time_chart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ impl FromStr for LegendPosition {
type Err = ParseLegendPositionError;

fn from_str(s: &str) -> Result<Self, Self::Err> {
match s.to_ascii_lowercase().as_str() {
match s {
"top" => Ok(Self::Top),
"top-left" => Ok(Self::TopLeft),
"top-right" => Ok(Self::TopRight),
Expand Down
7 changes: 5 additions & 2 deletions src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -960,8 +960,11 @@ fn get_network_legend_position(
position => Some(parse_config_value!(position.parse(), "network_legend")?),
}
} else if let Some(flags) = &config.flags {
if let Some(legend) = &flags.network_legend {
Some(parse_arg_value!(legend.parse(), "network_legend")?)
if let Some(s) = &flags.network_legend {
match s.to_ascii_lowercase().trim() {
"none" => None,
position => Some(parse_arg_value!(position.parse(), "network_legend")?),
}
} else {
Some(LegendPosition::default())
}
Expand Down

0 comments on commit 2f8aec7

Please sign in to comment.