Interface Pipeline

All Known Implementing Classes:
DefaultPipeline

public interface Pipeline
Represents a pipeline of commands connected by operators such as pipes, redirections, and conditional connectors.

A pipeline is built by chaining commands with operators:

 Pipeline pipeline = Pipeline.of("ls")
     .pipe("grep pattern")       // |
     .redirect(Path.of("out")) // > out
     .build();
 

Pipelines are immutable once built. Use of(String) to start building a pipeline.

Since:
4.0
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
    Operators that connect commands in a pipeline.
    static interface 
    A single stage in a pipeline, consisting of a command line and the operator that follows it.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns whether this pipeline should execute in the background.
    of(String command)
    Starts building a new pipeline with the given command.
    Returns the original command line string that was parsed to create this pipeline.
    Returns the ordered list of stages in this pipeline.
  • Method Details

    • stages

      List<Pipeline.Stage> stages()
      Returns the ordered list of stages in this pipeline.
      Returns:
      the stages
    • source

      String source()
      Returns the original command line string that was parsed to create this pipeline.
      Returns:
      the source command line
    • isBackground

      boolean isBackground()
      Returns whether this pipeline should execute in the background.
      Returns:
      true if background execution was requested
    • of

      static PipelineBuilder of(String command)
      Starts building a new pipeline with the given command.
      Parameters:
      command - the first command in the pipeline
      Returns:
      a new pipeline builder