Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Type and methods to build command pipelines and command lists #29

Closed
vladimirvivien opened this issue Aug 31, 2020 · 1 comment
Closed
Labels
enhancement New feature or request

Comments

@vladimirvivien
Copy link
Owner

vladimirvivien commented Aug 31, 2020

Echo users should be able to pipe one command's io output stream into a subsequent command

Create a Pipe Builder

A pipe builder builds a sequence of commands where the result of the one command is used as input for next command.

e.Pipe("echo $HOME").Into("grep vivien").Run()
  • Pipe creates type Pipe
  • Pipe.Into(string command) adds command to the pipe
  • Pipe.Run() terminates and execute the commands in the pipeline

All piped commands must terminate with a Proc result of zero to be successful. If a pipe fails, the pipe terminator method (see below) will stop and return immediately. The pipe can be configured with an all-or-none configuration where all commands must succeed. Another configuration should allow a command to fail and continue.

Pipe Terminators

  • Pipe.Run() Executes and terminates the pipe result and returns the result as a string
  • Pipe.RunProc Executes and terminates the pipe and returns a Proc for further processing (see echo.RunProc)
  • Pipe.StartProc Executes pipes in a separate goroutine and returns a Proc to inspect the running process
@vladimirvivien
Copy link
Owner Author

This was implemented with #43

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

No branches or pull requests

1 participant