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

Intentional early exit #5298

Open
philrz opened this issue Sep 22, 2024 · 2 comments
Open

Intentional early exit #5298

philrz opened this issue Sep 22, 2024 · 2 comments

Comments

@philrz
Copy link
Contributor

philrz commented Sep 22, 2024

tl;dr

A user may want to craft a pipeline that intentionally stops processing the input stream when a particular condition is met.

Details

At the time this issue is being filed, Zed is at commit c1da204.

A user inquired in a recent community Slack thread:

Are head and tail the only two ways to terminate processing a stream? If I'm processing a potentially long stream of text data (-i line), and I know I want to stop processing after, say, an empty line comes through, I can't think of a way to do that.

Upon seeing this @mattnibs remarked:

Yeah, I’ve thought about having an exit operator that takes a Boolean expression and exits when the expression evaluates true.

@chrismo
Copy link

chrismo commented Sep 22, 2024

How would this work on a branch? (i.e. within a fork call, etc). I presume exit could just terminate the current branch?

@mattnibs
Copy link
Collaborator

@chrismo a fork will keep passing values to all non-closed branches.

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

No branches or pull requests

3 participants