fmt, clippy
This commit is contained in:
parent
88f99f0b5d
commit
4391305743
|
@ -1,6 +1,6 @@
|
|||
use crate::{
|
||||
run_pager,
|
||||
util::{create_lscolors, create_map, map_into_value},
|
||||
util::{create_lscolors, create_map},
|
||||
PagerConfig,
|
||||
};
|
||||
use nu_ansi_term::{Color, Style};
|
||||
|
@ -8,8 +8,6 @@ use nu_color_config::{get_color_map, StyleComputer};
|
|||
use nu_engine::command_prelude::*;
|
||||
use nu_protocol::Config;
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
/// A `less` like program to render a [`Value`] as a table.
|
||||
#[derive(Clone)]
|
||||
pub struct Explore;
|
||||
|
@ -69,7 +67,7 @@ impl Command for Explore {
|
|||
let nu_config = engine_state.get_config();
|
||||
let style_computer = StyleComputer::from_config(engine_state, stack);
|
||||
|
||||
let mut explore_config = ExploreConfig::from_nu_config(&nu_config);
|
||||
let mut explore_config = ExploreConfig::from_nu_config(nu_config);
|
||||
explore_config.table.show_header = show_head;
|
||||
explore_config.table.show_index = show_index;
|
||||
explore_config.table.separator_style = lookup_color(&style_computer, "separator");
|
||||
|
|
|
@ -21,7 +21,7 @@ use terminal_size::{Height, Width};
|
|||
use views::{BinaryView, Orientation, Preview, RecordView};
|
||||
|
||||
mod util {
|
||||
pub use super::nu_common::{create_lscolors, create_map, map_into_value};
|
||||
pub use super::nu_common::{create_lscolors, create_map};
|
||||
}
|
||||
|
||||
fn run_pager(
|
||||
|
|
|
@ -18,7 +18,7 @@ pub use command::run_command_with_value;
|
|||
pub use lscolor::{create_lscolors, lscolorize};
|
||||
pub use string::{string_width, truncate_str};
|
||||
pub use table::try_build_table;
|
||||
pub use value::{collect_input, collect_pipeline, create_map, map_into_value};
|
||||
pub use value::{collect_input, collect_pipeline, create_map};
|
||||
|
||||
pub fn has_simple_value(data: &[Vec<Value>]) -> Option<&Value> {
|
||||
if data.len() == 1
|
||||
|
|
|
@ -176,10 +176,6 @@ pub fn create_map(value: &Value) -> Option<HashMap<String, Value>> {
|
|||
)
|
||||
}
|
||||
|
||||
pub fn map_into_value(hm: HashMap<String, Value>) -> Value {
|
||||
Value::record(hm.into_iter().collect(), NuSpan::unknown())
|
||||
}
|
||||
|
||||
fn unknown_error_value() -> Value {
|
||||
Value::string(String::from("❎"), NuSpan::unknown())
|
||||
}
|
||||
|
|
|
@ -375,13 +375,13 @@ fn draw_info(f: &mut Frame, pager: &mut Pager<'_>, info: ViewInfo) {
|
|||
if let Some(report) = info.status {
|
||||
let last_2nd_line = area.bottom().saturating_sub(2);
|
||||
let area = Rect::new(area.left(), last_2nd_line, area.width, 1);
|
||||
render_status_bar(f, area, report, &pager.config.explore_config);
|
||||
render_status_bar(f, area, report, pager.config.explore_config);
|
||||
}
|
||||
|
||||
{
|
||||
let last_line = area.bottom().saturating_sub(1);
|
||||
let area = Rect::new(area.left(), last_line, area.width, 1);
|
||||
render_cmd_bar(f, area, pager, info.report, &pager.config.explore_config);
|
||||
render_cmd_bar(f, area, pager, info.report, pager.config.explore_config);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -389,7 +389,7 @@ fn create_view_config<'a>(pager: &'a Pager<'_>) -> ViewConfig<'a> {
|
|||
let cfg = &pager.config;
|
||||
ViewConfig::new(
|
||||
cfg.nu_config,
|
||||
&cfg.explore_config,
|
||||
cfg.explore_config,
|
||||
cfg.style_computer,
|
||||
cfg.lscolors,
|
||||
)
|
||||
|
|
|
@ -89,7 +89,7 @@ impl View for BinaryView {
|
|||
}
|
||||
|
||||
fn setup(&mut self, cfg: ViewConfig<'_>) {
|
||||
self.settings = settings_from_config(&cfg.explore_config);
|
||||
self.settings = settings_from_config(cfg.explore_config);
|
||||
|
||||
let count_rows =
|
||||
BinaryWidget::new(&self.data, self.settings.opts, Default::default()).count_lines();
|
||||
|
|
|
@ -246,7 +246,7 @@ impl View for TryView<'_> {
|
|||
let mut r = RecordView::new(vec![], vec![]);
|
||||
r.setup(config);
|
||||
|
||||
self.table_theme = config.explore_config.table.clone();
|
||||
self.table_theme = config.explore_config.table;
|
||||
|
||||
if let Some(view) = &mut self.table {
|
||||
view.set_orientation(r.get_orientation_current());
|
||||
|
|
Loading…
Reference in New Issue
Block a user