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 Ansi.apply method #188

Merged
merged 1 commit into from
Jan 20, 2021
Merged

Add Ansi.apply method #188

merged 1 commit into from
Jan 20, 2021

Conversation

romge
Copy link
Contributor

@romge romge commented Dec 25, 2020

Adds a new method "apply" to the Ansi class. This is especially useful when used with lambdas. Applying other functions to the Ansi class is now possible without breaking out of the fluent API flow. This is best shown with the following example:

Before:

Ansi ansi = Ansi.ansi().fgRed();
complexFunction(ansi);
ansi.reset();

Now:

Ansi ansi = Ansi.ansi().fgRed().apply(this::complexFunction).reset();

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.

2 participants