mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 06:55:36 +02:00
Match cleanup (#2248)
This commit is contained in:
@ -48,48 +48,15 @@ pub fn view_text_value(value: &Value) {
|
||||
_ => 4u64,
|
||||
}
|
||||
}
|
||||
"colored_output" => {
|
||||
colored_output = match value.as_bool() {
|
||||
Ok(b) => b,
|
||||
_ => true,
|
||||
}
|
||||
}
|
||||
"true_color" => {
|
||||
true_color = match value.as_bool() {
|
||||
Ok(b) => b,
|
||||
_ => true,
|
||||
}
|
||||
}
|
||||
"header" => {
|
||||
header = match value.as_bool() {
|
||||
Ok(b) => b,
|
||||
_ => true,
|
||||
}
|
||||
}
|
||||
"line_numbers" => {
|
||||
line_numbers = match value.as_bool() {
|
||||
Ok(b) => b,
|
||||
_ => true,
|
||||
}
|
||||
}
|
||||
"grid" => {
|
||||
grid = match value.as_bool() {
|
||||
Ok(b) => b,
|
||||
_ => true,
|
||||
}
|
||||
}
|
||||
"colored_output" => colored_output = value.as_bool().unwrap_or(true),
|
||||
"true_color" => true_color = value.as_bool().unwrap_or(true),
|
||||
"header" => header = value.as_bool().unwrap_or(true),
|
||||
"line_numbers" => line_numbers = value.as_bool().unwrap_or(true),
|
||||
"grid" => grid = value.as_bool().unwrap_or(true),
|
||||
"vcs_modification_markers" => {
|
||||
vcs_modification_markers = match value.as_bool() {
|
||||
Ok(b) => b,
|
||||
_ => true,
|
||||
}
|
||||
}
|
||||
"snip" => {
|
||||
snip = match value.as_bool() {
|
||||
Ok(b) => b,
|
||||
_ => true,
|
||||
}
|
||||
vcs_modification_markers = value.as_bool().unwrap_or(true)
|
||||
}
|
||||
"snip" => snip = value.as_bool().unwrap_or(true),
|
||||
"wrapping_mode" => {
|
||||
wrapping_mode = match value.as_string() {
|
||||
Ok(s) if s.to_lowercase() == "nowrapping" => {
|
||||
@ -101,12 +68,7 @@ pub fn view_text_value(value: &Value) {
|
||||
_ => bat::WrappingMode::NoWrapping,
|
||||
}
|
||||
}
|
||||
"use_italics" => {
|
||||
use_italics = match value.as_bool() {
|
||||
Ok(b) => b,
|
||||
_ => true,
|
||||
}
|
||||
}
|
||||
"use_italics" => use_italics = value.as_bool().unwrap_or(true),
|
||||
"paging_mode" => {
|
||||
paging_mode = match value.as_string() {
|
||||
Ok(s) if s.to_lowercase() == "always" => bat::PagingMode::Always,
|
||||
@ -117,19 +79,13 @@ pub fn view_text_value(value: &Value) {
|
||||
_ => bat::PagingMode::QuitIfOneScreen,
|
||||
}
|
||||
}
|
||||
"pager" => {
|
||||
pager = match value.as_string() {
|
||||
Ok(s) => s,
|
||||
_ => "less".to_string(),
|
||||
}
|
||||
}
|
||||
"pager" => pager = value.as_string().unwrap_or_else(|_| "less".to_string()),
|
||||
"line_ranges" => line_ranges = bat::line_range::LineRanges::all(), // not real sure what to do with this
|
||||
"highlight_range" => _highlight_range = "0,0", //ignore config value for now
|
||||
"theme" => {
|
||||
theme = match value.as_string() {
|
||||
Ok(s) => s,
|
||||
_ => "OneDarkHalf".to_string(),
|
||||
}
|
||||
theme = value
|
||||
.as_string()
|
||||
.unwrap_or_else(|_| "OneDarkHalf".to_string())
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
|
Reference in New Issue
Block a user