diff --git a/crates/nu-command/src/viewers/table.rs b/crates/nu-command/src/viewers/table.rs index 14eb0ece6d..44fee9aca5 100644 --- a/crates/nu-command/src/viewers/table.rs +++ b/crates/nu-command/src/viewers/table.rs @@ -321,21 +321,16 @@ fn get_theme_flag( state: &EngineState, stack: &mut Stack, ) -> Result, ShellError> { - let theme_name = call.get_flag(state, stack, "theme")?; - theme_name - .clone() - .map(|theme: String| TableMode::from_str(&theme)) - .transpose() - .map_err(|err| ShellError::CantConvert { - to_type: String::from("theme"), - from_type: String::from("string"), - span: call.span(), - help: Some(format!( - "{}, but found '{}'.", - String::from(err), - theme_name.unwrap_or("".to_string()) - )), + call.get_flag(state, stack, "theme")? + .map(|theme: String| { + TableMode::from_str(&theme).map_err(|err| ShellError::CantConvert { + to_type: String::from("theme"), + from_type: String::from("string"), + span: call.span(), + help: Some(format!("{}, but found '{}'.", err, theme)), + }) }) + .transpose() } struct CmdInput<'a> { diff --git a/crates/nu-protocol/src/config/table.rs b/crates/nu-protocol/src/config/table.rs index 4100ee7da7..c26fca2caf 100644 --- a/crates/nu-protocol/src/config/table.rs +++ b/crates/nu-protocol/src/config/table.rs @@ -11,7 +11,6 @@ pub enum TableMode { Compact, WithLove, CompactDouble, - Default, #[default] Rounded, Reinforced, @@ -36,7 +35,7 @@ impl FromStr for TableMode { "compact" => Ok(Self::Compact), "with_love" => Ok(Self::WithLove), "compact_double" => Ok(Self::CompactDouble), - "default" => Ok(Self::Rounded), + "default" => Ok(TableMode::default()), "rounded" => Ok(Self::Rounded), "reinforced" => Ok(Self::Reinforced), "heavy" => Ok(Self::Heavy), @@ -62,7 +61,6 @@ impl ReconstructVal for TableMode { TableMode::Compact => "compact", TableMode::WithLove => "with_love", TableMode::CompactDouble => "compact_double", - TableMode::Default => "rounded", TableMode::Rounded => "rounded", TableMode::Reinforced => "reinforced", TableMode::Heavy => "heavy", diff --git a/crates/nu-table/src/common.rs b/crates/nu-table/src/common.rs index b767129ab4..89455e45e2 100644 --- a/crates/nu-table/src/common.rs +++ b/crates/nu-table/src/common.rs @@ -182,7 +182,6 @@ pub fn load_theme(mode: TableMode) -> TableTheme { TableMode::Compact => TableTheme::compact(), TableMode::WithLove => TableTheme::with_love(), TableMode::CompactDouble => TableTheme::compact_double(), - TableMode::Default => TableTheme::rounded(), TableMode::Rounded => TableTheme::rounded(), TableMode::Reinforced => TableTheme::reinforced(), TableMode::Heavy => TableTheme::heavy(),