Skip to content

Conversation

cmcgee1024
Copy link
Member

@cmcgee1024 cmcgee1024 commented Sep 6, 2025

Create complex pipeline stages and run the pipeline configuration using a single I/O configuration based on the usual Input, Output, and Error options provided by the existing run() functions.

Each stage can be either a process or a Swift function. For processes there are the typical executable, arguments, or configuration parameters. There is an additional process option to rewire standard output and standard error in typical ways, such as merging the two to standard output, or replacing standard output with standard error.

A Swift function stage can read from its input, and write to its output/error streams much like a process, but provides the full Swift power in the current process to parse JSON and do other powerful things. Similarly, an exit code can be returned.

Provide a rich set of top-level functions, methods and overloaded operators to construct and execute the pipelines.

// Using .finally() method
var config = pipe(
    .name("echo"),
    arguments: ["Hello World"]
).stage(
    executable: .name("wc"),
    arguments: ["-c"]
).finally(
    output: .string(limit: 1024)
)

// Using | and |> operators
config = pipe(
   .name("echo"),
    arguments: ["Hello World"]
)
| (
   .name("wc"),
    arguments: ["-c"]
)
|> .string(limit: 1024)

let result = try await config.run()
print(result.standardOutput) // "12"

Create complex pipeline stages and run the pipeline configuration
using a single I/O configuration based on the usual Input, Output,
and Error options provided by the existing run() functions.

Each stage can be either a process or a Swift function. For processes
there are the typical executable, arguments, or configuration
parameters. There is an additional process option to rewire standard
output and standard error in typical ways, such as merging the two
to standard output, or replacing standard output with standard error.

A Swift function stage can read from its input, and write to its
output/error streams much like a process, but provides the full
Swift power in the current process to parse JSON and do other powerful
things. Similarly, an exit code can be returned.

Provide a rich set of top-level functions, methods and overloaded
operators to construct and execute the pipelines.
@cmcgee1024 cmcgee1024 marked this pull request as draft September 7, 2025 23:57
@cmcgee1024 cmcgee1024 marked this pull request as ready for review September 9, 2025 20:07
@cmcgee1024
Copy link
Member Author

The macOS build error seems unrelated to the changes here. It's failing on an ambiguous Region type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant