add nu-ansi-term (#3089)

This commit is contained in:
Darren Schroeder
2021-02-22 12:33:34 -06:00
committed by GitHub
parent 803826cdcd
commit 2c89a228d5
40 changed files with 2510 additions and 46 deletions

View File

@ -23,9 +23,9 @@ nu-stream = { version = "0.27.1", path = "../nu-stream" }
nu-table = { version = "0.27.1", path = "../nu-table" }
nu-test-support = { version = "0.27.1", path = "../nu-test-support" }
nu-value-ext = { version = "0.27.1", path = "../nu-value-ext" }
nu-ansi-term = { version = "0.27.1", path = "../nu-ansi-term" }
Inflector = "0.11"
ansi_term = "0.12.1"
arboard = { version = "1.1.0", optional = true }
async-recursion = "0.3.2"
async-trait = "0.1.42"

View File

@ -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};

View File

@ -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(

View File

@ -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)),
),
);

View File

@ -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 {