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. :)

![image](https://user-images.githubusercontent.com/343840/217896776-99c6bece-172c-4d3d-8cec-dda85d37cada.png)
This commit is contained in:
Darren Schroeder
2023-02-09 13:59:38 -06:00
committed by GitHub
parent 16b99ed0ba
commit c31225fdcf
4 changed files with 346 additions and 0 deletions

View File

@ -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,