Fix coloring of commands

This commit is contained in:
Jonathan Turner 2019-06-24 16:00:16 +12:00
parent 62368644fa
commit dd4e59d627

View File

@ -97,6 +97,7 @@ impl Highlighter for Helper {
}
fn paint_token_node(token_node: &TokenNode, line: &str) -> String {
//println!("{:?}", token_node);
let styled = match token_node {
TokenNode::Call(..) => Color::Cyan.bold().paint(token_node.span().slice(line)),
TokenNode::Whitespace(..) => Color::White.normal().paint(token_node.span().slice(line)),
@ -105,7 +106,7 @@ fn paint_token_node(token_node: &TokenNode, line: &str) -> String {
TokenNode::Path(..) => Color::Green.bold().paint(token_node.span().slice(line)),
TokenNode::Error(..) => Color::Red.bold().paint(token_node.span().slice(line)),
TokenNode::Delimited(..) => Color::White.paint(token_node.span().slice(line)),
TokenNode::Operator(..) => Color::Purple.bold().paint(token_node.span().slice(line)),
TokenNode::Operator(..) => Color::White.normal().paint(token_node.span().slice(line)),
TokenNode::Pipeline(..) => Color::Blue.normal().paint(token_node.span().slice(line)),
TokenNode::Token(Spanned {
item: RawToken::Integer(..),
@ -139,7 +140,7 @@ fn paint_pipeline_element(pipeline_element: &PipelineElement, line: &str) -> Str
styled.push_str(&Color::White.normal().paint(ws.slice(line)));
}
styled.push_str(&paint_token_node(pipeline_element.call().head(), line));
styled.push_str(&Color::Cyan.bold().paint(pipeline_element.call().head().span().slice(line)).to_string());
if let Some(children) = pipeline_element.call().children() {
for child in children {