forked from extern/nushell
explain command (#7957)
# Description The purpose of this PR is to introduce the `inspect` command. A command that is used to inspect, but not run, a pipeline to ensure everything looks right. This is meant as a debugging tool. This is some hackery, so don't laugh. :) 
This commit is contained in:
@ -23,6 +23,19 @@ pub enum PipelineElement {
|
||||
}
|
||||
|
||||
impl PipelineElement {
|
||||
pub fn expression(&self) -> &Expression {
|
||||
match self {
|
||||
PipelineElement::Expression(_, expression) => expression,
|
||||
PipelineElement::Redirection(_, _, expression) => expression,
|
||||
PipelineElement::SeparateRedirection {
|
||||
out: (_, expression),
|
||||
..
|
||||
} => expression,
|
||||
PipelineElement::And(_, expression) => expression,
|
||||
PipelineElement::Or(_, expression) => expression,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn span(&self) -> Span {
|
||||
match self {
|
||||
PipelineElement::Expression(None, expression) => expression.span,
|
||||
|
Reference in New Issue
Block a user