a new command to query the nushell internals (#3704)

* a new command to query the nushell internals

* added signature

* a little cleanup
This commit is contained in:
Darren Schroeder
2021-06-29 09:27:16 -05:00
committed by GitHub
parent 1d0483c946
commit 008bdfa43f
13 changed files with 379 additions and 16 deletions

View File

@ -39,10 +39,9 @@ pub enum SyntaxShape {
MathExpression,
}
impl PrettyDebug for SyntaxShape {
/// Prepare SyntaxShape for pretty-printing
fn pretty(&self) -> DebugDocBuilder {
DbgDocBldr::kind(match self {
impl SyntaxShape {
pub fn syntax_shape_name(&self) -> &str {
match self {
SyntaxShape::Any => "any",
SyntaxShape::String => "string",
SyntaxShape::FullColumnPath => "column path (with variable)",
@ -59,6 +58,13 @@ impl PrettyDebug for SyntaxShape {
SyntaxShape::Operator => "operator",
SyntaxShape::RowCondition => "condition",
SyntaxShape::MathExpression => "math expression",
})
}
}
}
impl PrettyDebug for SyntaxShape {
/// Prepare SyntaxShape for pretty-printing
fn pretty(&self) -> DebugDocBuilder {
DbgDocBldr::kind(self.syntax_shape_name().to_string())
}
}