add missing shapes to default_config (#7472)

# Description

We've added some shapes recently. This PR adds them to the
default_config and sorts them in order to make finding missing ones
easier.

# User-Facing Changes


# Tests + Formatting

Don't forget to add tests that cover your changes.

Make sure you've run and fixed any issues with these commands:

- `cargo fmt --all -- --check` to check standard code formatting (`cargo
fmt --all` applies these changes)
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A
clippy::needless_collect` to check that you're using the standard code
style
- `cargo test --workspace` to check that all tests pass

# After Submitting

If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.
This commit is contained in:
Darren Schroeder 2022-12-14 07:11:17 -06:00 committed by GitHub
parent 52278f8562
commit 0db4d89838
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 100 additions and 92 deletions

View File

@ -9,36 +9,36 @@ pub fn get_shape_color(shape: String, conf: &Config) -> Style {
Err(_) => Style::default(),
},
None => match shape.as_ref() {
"shape_garbage" => Style::new().fg(Color::White).on(Color::Red).bold(),
"shape_and" => Style::new().fg(Color::Purple).bold(),
"shape_binary" => Style::new().fg(Color::Purple).bold(),
"shape_block" => Style::new().fg(Color::Blue).bold(),
"shape_bool" => Style::new().fg(Color::LightCyan),
"shape_int" => Style::new().fg(Color::Purple).bold(),
"shape_float" => Style::new().fg(Color::Purple).bold(),
"shape_range" => Style::new().fg(Color::Yellow).bold(),
"shape_internalcall" => Style::new().fg(Color::Cyan).bold(),
"shape_custom" => Style::new().fg(Color::Green),
"shape_datetime" => Style::new().fg(Color::Cyan).bold(),
"shape_directory" => Style::new().fg(Color::Cyan),
"shape_external" => Style::new().fg(Color::Cyan),
"shape_externalarg" => Style::new().fg(Color::Green).bold(),
"shape_filepath" => Style::new().fg(Color::Cyan),
"shape_flag" => Style::new().fg(Color::Blue).bold(),
"shape_float" => Style::new().fg(Color::Purple).bold(),
"shape_garbage" => Style::new().fg(Color::White).on(Color::Red).bold(),
"shape_globpattern" => Style::new().fg(Color::Cyan).bold(),
"shape_int" => Style::new().fg(Color::Purple).bold(),
"shape_internalcall" => Style::new().fg(Color::Cyan).bold(),
"shape_list" => Style::new().fg(Color::Cyan).bold(),
"shape_literal" => Style::new().fg(Color::Blue),
"shape_nothing" => Style::new().fg(Color::LightCyan),
"shape_operator" => Style::new().fg(Color::Yellow),
"shape_or" => Style::new().fg(Color::Purple).bold(),
"shape_pipe" => Style::new().fg(Color::Purple).bold(),
"shape_range" => Style::new().fg(Color::Yellow).bold(),
"shape_record" => Style::new().fg(Color::Cyan).bold(),
"shape_redirection" => Style::new().fg(Color::Purple).bold(),
"shape_signature" => Style::new().fg(Color::Green).bold(),
"shape_string" => Style::new().fg(Color::Green),
"shape_string_interpolation" => Style::new().fg(Color::Cyan).bold(),
"shape_datetime" => Style::new().fg(Color::Cyan).bold(),
"shape_list" => Style::new().fg(Color::Cyan).bold(),
"shape_table" => Style::new().fg(Color::Blue).bold(),
"shape_record" => Style::new().fg(Color::Cyan).bold(),
"shape_block" => Style::new().fg(Color::Blue).bold(),
"shape_filepath" => Style::new().fg(Color::Cyan),
"shape_directory" => Style::new().fg(Color::Cyan),
"shape_globpattern" => Style::new().fg(Color::Cyan).bold(),
"shape_variable" => Style::new().fg(Color::Purple),
"shape_flag" => Style::new().fg(Color::Blue).bold(),
"shape_custom" => Style::new().fg(Color::Green),
"shape_pipe" => Style::new().fg(Color::Purple).bold(),
"shape_redirection" => Style::new().fg(Color::Purple).bold(),
"shape_and" => Style::new().fg(Color::Purple).bold(),
"shape_or" => Style::new().fg(Color::Purple).bold(),
"shape_nothing" => Style::new().fg(Color::LightCyan),
_ => Style::default(),
},
}

View File

@ -7,71 +7,71 @@ use std::fmt::{Display, Formatter, Result};
#[derive(Debug, Eq, PartialEq, Ord, Clone, PartialOrd)]
pub enum FlatShape {
Garbage,
Nothing,
Bool,
And,
Binary,
Int,
Float,
Range,
InternalCall,
Block,
Bool,
Custom(DeclId),
DateTime,
Directory,
External,
ExternalArg,
Filepath,
Flag,
Float,
Garbage,
GlobPattern,
Int,
InternalCall,
List,
Literal,
Nothing,
Operator,
Or,
Pipe,
Range,
Record,
Redirection,
Signature,
String,
StringInterpolation,
List,
Table,
Record,
Block,
Filepath,
Directory,
DateTime,
GlobPattern,
Variable,
Flag,
Pipe,
And,
Or,
Redirection,
Custom(DeclId),
}
impl Display for FlatShape {
fn fmt(&self, f: &mut Formatter) -> Result {
match self {
FlatShape::Garbage => write!(f, "shape_garbage"),
FlatShape::Nothing => write!(f, "shape_nothing"),
FlatShape::And => write!(f, "shape_and"),
FlatShape::Binary => write!(f, "shape_binary"),
FlatShape::Block => write!(f, "shape_block"),
FlatShape::Bool => write!(f, "shape_bool"),
FlatShape::Int => write!(f, "shape_int"),
FlatShape::Float => write!(f, "shape_float"),
FlatShape::Range => write!(f, "shape_range"),
FlatShape::InternalCall => write!(f, "shape_internalcall"),
FlatShape::Custom(_) => write!(f, "shape_custom"),
FlatShape::DateTime => write!(f, "shape_datetime"),
FlatShape::Directory => write!(f, "shape_directory"),
FlatShape::External => write!(f, "shape_external"),
FlatShape::ExternalArg => write!(f, "shape_externalarg"),
FlatShape::Filepath => write!(f, "shape_filepath"),
FlatShape::Flag => write!(f, "shape_flag"),
FlatShape::Float => write!(f, "shape_float"),
FlatShape::Garbage => write!(f, "shape_garbage"),
FlatShape::GlobPattern => write!(f, "shape_globpattern"),
FlatShape::Int => write!(f, "shape_int"),
FlatShape::InternalCall => write!(f, "shape_internalcall"),
FlatShape::List => write!(f, "shape_list"),
FlatShape::Literal => write!(f, "shape_literal"),
FlatShape::Nothing => write!(f, "shape_nothing"),
FlatShape::Operator => write!(f, "shape_operator"),
FlatShape::Or => write!(f, "shape_or"),
FlatShape::Pipe => write!(f, "shape_pipe"),
FlatShape::Range => write!(f, "shape_range"),
FlatShape::Record => write!(f, "shape_record"),
FlatShape::Redirection => write!(f, "shape_redirection"),
FlatShape::Signature => write!(f, "shape_signature"),
FlatShape::String => write!(f, "shape_string"),
FlatShape::DateTime => write!(f, "shape_datetime"),
FlatShape::StringInterpolation => write!(f, "shape_string_interpolation"),
FlatShape::List => write!(f, "shape_list"),
FlatShape::Table => write!(f, "shape_table"),
FlatShape::Record => write!(f, "shape_record"),
FlatShape::Block => write!(f, "shape_block"),
FlatShape::Filepath => write!(f, "shape_filepath"),
FlatShape::Directory => write!(f, "shape_directory"),
FlatShape::GlobPattern => write!(f, "shape_globpattern"),
FlatShape::Variable => write!(f, "shape_variable"),
FlatShape::Flag => write!(f, "shape_flag"),
FlatShape::Pipe => write!(f, "shape_pipe"),
FlatShape::And => write!(f, "shape_and"),
FlatShape::Or => write!(f, "shape_or"),
FlatShape::Redirection => write!(f, "shape_redirection"),
FlatShape::Custom(_) => write!(f, "shape_custom"),
}
}
}

View File

@ -152,34 +152,38 @@ let dark_theme = {
block: white
hints: dark_gray
# shapes are used to change the cli syntax highlighting
shape_garbage: { fg: "#FFFFFF" bg: "#FF0000" attr: b}
shape_and: purple_bold
shape_binary: purple_bold
shape_block: blue_bold
shape_bool: light_cyan
shape_int: purple_bold
shape_float: purple_bold
shape_range: yellow_bold
shape_internalcall: cyan_bold
shape_custom: green
shape_datetime: cyan_bold
shape_directory: cyan
shape_external: cyan
shape_externalarg: green_bold
shape_filepath: cyan
shape_flag: blue_bold
shape_float: purple_bold
# shapes are used to change the cli syntax highlighting
shape_garbage: { fg: "#FFFFFF" bg: "#FF0000" attr: b}
shape_globpattern: cyan_bold
shape_int: purple_bold
shape_internalcall: cyan_bold
shape_list: cyan_bold
shape_literal: blue
shape_matching_brackets: { attr: u }
shape_nothing: light_cyan
shape_operator: yellow
shape_or: purple_bold
shape_pipe: purple_bold
shape_range: yellow_bold
shape_record: cyan_bold
shape_redirection: purple_bold
shape_signature: green_bold
shape_string: green
shape_string_interpolation: cyan_bold
shape_datetime: cyan_bold
shape_list: cyan_bold
shape_table: blue_bold
shape_record: cyan_bold
shape_block: blue_bold
shape_filepath: cyan
shape_directory: cyan
shape_globpattern: cyan_bold
shape_variable: purple
shape_flag: blue_bold
shape_custom: green
shape_nothing: light_cyan
shape_matching_brackets: { attr: u }
}
let light_theme = {
@ -205,34 +209,38 @@ let light_theme = {
block: white
hints: dark_gray
# shapes are used to change the cli syntax highlighting
shape_garbage: { fg: "#FFFFFF" bg: "#FF0000" attr: b}
shape_and: purple_bold
shape_binary: purple_bold
shape_block: blue_bold
shape_bool: light_cyan
shape_int: purple_bold
shape_float: purple_bold
shape_range: yellow_bold
shape_internalcall: cyan_bold
shape_custom: green
shape_datetime: cyan_bold
shape_directory: cyan
shape_external: cyan
shape_externalarg: green_bold
shape_filepath: cyan
shape_flag: blue_bold
shape_float: purple_bold
# shapes are used to change the cli syntax highlighting
shape_garbage: { fg: "#FFFFFF" bg: "#FF0000" attr: b}
shape_globpattern: cyan_bold
shape_int: purple_bold
shape_internalcall: cyan_bold
shape_list: cyan_bold
shape_literal: blue
shape_matching_brackets: { attr: u }
shape_nothing: light_cyan
shape_operator: yellow
shape_or: purple_bold
shape_pipe: purple_bold
shape_range: yellow_bold
shape_record: cyan_bold
shape_redirection: purple_bold
shape_signature: green_bold
shape_string: green
shape_string_interpolation: cyan_bold
shape_datetime: cyan_bold
shape_list: cyan_bold
shape_table: blue_bold
shape_record: cyan_bold
shape_block: blue_bold
shape_filepath: cyan
shape_directory: cyan
shape_globpattern: cyan_bold
shape_variable: purple
shape_flag: blue_bold
shape_custom: green
shape_nothing: light_cyan
shape_matching_brackets: { attr: u }
}
# External completer example