feat: add terminal progress indicators - #4
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Add opt-in OSC 9;4 terminal progress support to the existing loader and progress lifecycles.
New API
console.Configgains one optional field:No new loader or progress methods are required. Enabling the option augments the established APIs:
Loader.Startpublishes indeterminate terminal activity.Loader.Stop,Loader.Success,Loader.Warn, andLoader.Failclear it.Progress.Startpublishes the current percentage, including a value set before start.Progress.Set,Progress.Add, andProgress.Stepupdate the terminal percentage.Progress.Stop,Progress.Complete, andProgress.Failclear it.Example
Supporting terminal emulators decide whether progress appears in a tab, window edge, or operating-system taskbar. The option is independent of
AnimationsEnabled, requires an ANSI-capable terminal, and never emits OSC sequences into redirected output. Console-wide ownership prevents concurrent lifecycles from clearing one another.The README documents the capability, and focused coverage exercises loader and progress lifecycles, capability gating, percentage bounds, idempotence, and concurrent ownership.
Why
Terminal-owned progress makes long-running GoForj work visible without consuming console rows or requiring each application to implement escape protocols itself. Keeping it behind an explicit configuration option preserves existing output behavior for current consumers.