mirror of
https://github.com/sharkdp/bat
synced 2026-08-08 19:41:45 +00:00
feat: implement --unbuffered mode for streaming input (#3555)
Repurpose the existing --unbuffered/-u flag (previously a POSIX no-op) to enable unbuffered input reading using fill_buf()/consume() instead of read_until(b'\n'). This allows partial lines to display immediately when piping streaming input like `tail -f` into bat. - Add unbuffered field to Config and InputReader - Add read_line_unbuffered() using BufRead::fill_buf()/consume() - Add flush() to OutputHandle, called after each line in unbuffered mode - Auto-disable line numbers in unbuffered mode to avoid partial line confusion - Update help text, man page, and shell completions - Add unit tests and integration tests
This commit is contained in:
@@ -110,6 +110,9 @@ pub struct Config<'a> {
|
||||
|
||||
/// Whether or not to produce no output when input is empty
|
||||
pub quiet_empty: bool,
|
||||
|
||||
/// Whether or not to use unbuffered input reading for streaming use cases
|
||||
pub unbuffered: bool,
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "minimal-application", feature = "paging"))]
|
||||
|
||||
Reference in New Issue
Block a user