forked from extern/nushell
add nu-ansi-term (#3089)
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
use crate::prelude::*;
|
||||
use ansi_term::Color;
|
||||
use nu_ansi_term::*;
|
||||
use nu_engine::WholeStreamCommand;
|
||||
use nu_errors::ShellError;
|
||||
use nu_protocol::{ReturnSuccess, Signature, SyntaxShape, UntaggedValue, Value};
|
||||
|
@ -240,7 +240,7 @@ pub async fn autoview(context: RunnableContext) -> Result<OutputStream, ShellErr
|
||||
key.to_string(),
|
||||
TextStyle::new()
|
||||
.alignment(nu_table::Alignment::Left)
|
||||
.fg(ansi_term::Color::Green)
|
||||
.fg(nu_ansi_term::Color::Green)
|
||||
.bold(Some(true)),
|
||||
),
|
||||
nu_table::StyledString::new(
|
||||
|
@ -42,7 +42,7 @@ pub fn from_list(
|
||||
values: &[Value],
|
||||
configuration: &TableConfiguration,
|
||||
starting_idx: usize,
|
||||
color_hm: &HashMap<String, ansi_term::Style>,
|
||||
color_hm: &HashMap<String, nu_ansi_term::Style>,
|
||||
) -> nu_table::Table {
|
||||
let header_style = configuration.header_style();
|
||||
let mut headers: Vec<StyledString> = nu_protocol::merge_descriptors(values)
|
||||
@ -62,7 +62,7 @@ fn values_to_entries(
|
||||
headers: &mut Vec<StyledString>,
|
||||
configuration: &TableConfiguration,
|
||||
starting_idx: usize,
|
||||
color_hm: &HashMap<String, ansi_term::Style>,
|
||||
color_hm: &HashMap<String, nu_ansi_term::Style>,
|
||||
) -> Vec<Vec<StyledString>> {
|
||||
let disable_indexes = configuration.disabled_indexes();
|
||||
let mut entries = vec![];
|
||||
@ -122,9 +122,9 @@ fn values_to_entries(
|
||||
color_hm
|
||||
.get("index_color")
|
||||
.unwrap_or(
|
||||
&ansi_term::Style::default()
|
||||
&nu_ansi_term::Style::default()
|
||||
.bold()
|
||||
.fg(ansi_term::Color::Green),
|
||||
.fg(nu_ansi_term::Color::Green),
|
||||
)
|
||||
.to_owned(),
|
||||
),
|
||||
@ -142,7 +142,7 @@ fn values_to_entries(
|
||||
"#".to_owned(),
|
||||
TextStyle::new()
|
||||
.alignment(Alignment::Center)
|
||||
.fg(ansi_term::Color::Green)
|
||||
.fg(nu_ansi_term::Color::Green)
|
||||
.bold(Some(true)),
|
||||
),
|
||||
);
|
||||
|
@ -80,7 +80,7 @@ impl ConfigExtensions for NuConfig {
|
||||
Some(s) => {
|
||||
lookup_ansi_color_style(s.as_string().unwrap_or_else(|_| "green".to_string()))
|
||||
}
|
||||
None => ansi_term::Color::Green.normal(),
|
||||
None => nu_ansi_term::Color::Green.normal(),
|
||||
};
|
||||
let head_bold = get_color_from_key_and_subkey(self, "color_config", "header_bold");
|
||||
let head_bold_bool = match head_bold {
|
||||
@ -98,7 +98,7 @@ impl ConfigExtensions for NuConfig {
|
||||
.bold(Some(head_bold_bool))
|
||||
.fg(head_color_style
|
||||
.foreground
|
||||
.unwrap_or(ansi_term::Color::Green))
|
||||
.unwrap_or(nu_ansi_term::Color::Green))
|
||||
}
|
||||
|
||||
fn table_mode(&self) -> nu_table::Theme {
|
||||
|
Reference in New Issue
Block a user