forked from extern/nushell
ref #7332 Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com> Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com>
35 lines
985 B
Rust
35 lines
985 B
Rust
mod command;
|
|
mod string;
|
|
mod table;
|
|
mod value;
|
|
|
|
use std::{
|
|
collections::HashMap,
|
|
sync::{atomic::AtomicBool, Arc},
|
|
};
|
|
|
|
use nu_protocol::Value;
|
|
use nu_table::TextStyle;
|
|
|
|
pub use nu_ansi_term::{Color as NuColor, Style as NuStyle};
|
|
pub use nu_protocol::{Config as NuConfig, Span as NuSpan};
|
|
|
|
pub type NuText = (String, TextStyle);
|
|
pub type CtrlC = Option<Arc<AtomicBool>>;
|
|
pub type NuStyleTable = HashMap<String, NuStyle>;
|
|
|
|
pub use command::{is_ignored_command, run_command_with_value, run_nu_command};
|
|
pub use string::truncate_str;
|
|
pub use table::try_build_table;
|
|
pub use value::{collect_input, collect_pipeline, create_map, map_into_value, nu_str};
|
|
|
|
pub fn has_simple_value(data: &[Vec<Value>]) -> Option<&Value> {
|
|
let has_single_value = data.len() == 1 && data[0].len() == 1;
|
|
let is_complex_type = matches!(&data[0][0], Value::List { .. } | Value::Record { .. });
|
|
if has_single_value && !is_complex_type {
|
|
Some(&data[0][0])
|
|
} else {
|
|
None
|
|
}
|
|
}
|