mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 06:35:56 +02:00
add nu-ansi-term (#3089)
This commit is contained in:
@ -10,14 +10,14 @@ const COMMANDS_DOCS_DIR: &str = "docs/commands";
|
||||
|
||||
pub struct DocumentationConfig {
|
||||
no_subcommands: bool,
|
||||
no_colour: bool,
|
||||
no_color: bool,
|
||||
}
|
||||
|
||||
impl Default for DocumentationConfig {
|
||||
fn default() -> Self {
|
||||
DocumentationConfig {
|
||||
no_subcommands: false,
|
||||
no_colour: false,
|
||||
no_color: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -48,7 +48,7 @@ fn generate_doc(name: &str, scope: &Scope) -> IndexMap<String, Value> {
|
||||
scope,
|
||||
&DocumentationConfig {
|
||||
no_subcommands: true,
|
||||
no_colour: true,
|
||||
no_color: true,
|
||||
},
|
||||
))
|
||||
.into_untagged_value(),
|
||||
@ -211,7 +211,7 @@ pub fn get_documentation(
|
||||
long_desc.push_str(" ");
|
||||
long_desc.push_str(example.description);
|
||||
|
||||
if config.no_colour {
|
||||
if config.no_color {
|
||||
long_desc.push_str(&format!("\n > {}\n", example.example));
|
||||
} else {
|
||||
let colored_example =
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::evaluate::scope::Scope;
|
||||
use crate::shell::palette::Palette;
|
||||
use ansi_term::{Color, Style};
|
||||
use nu_ansi_term::{Color, Style};
|
||||
use nu_parser::ParserScope;
|
||||
use nu_protocol::hir::FlatShape;
|
||||
use nu_source::Spanned;
|
||||
|
@ -1,4 +1,4 @@
|
||||
use ansi_term::{Color, Style};
|
||||
use nu_ansi_term::{Color, Style};
|
||||
use nu_protocol::hir::FlatShape;
|
||||
use nu_source::{Span, Spanned};
|
||||
use serde::{self, Deserialize, Deserializer, Serialize, Serializer};
|
||||
@ -278,7 +278,7 @@ fn single_style_span(style: Style, span: Span) -> Vec<Spanned<Style>> {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{Palette, ThemedPalette};
|
||||
use ansi_term::Color;
|
||||
use nu_ansi_term::Color;
|
||||
use nu_protocol::hir::FlatShape;
|
||||
use nu_source::{Span, Spanned};
|
||||
use std::io::Cursor;
|
||||
|
Reference in New Issue
Block a user