add pulsing dot loading state (#4736)
## Description Changes default CLI spinner to pulsing dot https://github.com/user-attachments/assets/b81225d6-6655-4ead-8cb1-d6568a603d5b ## Tests Passes CI --------- Co-authored-by: Fouad Matin <fouad@openai.com>
This commit is contained in:
@@ -116,12 +116,10 @@ pub(crate) fn output_lines(
|
||||
}
|
||||
|
||||
pub(crate) fn spinner(start_time: Option<Instant>) -> Span<'static> {
|
||||
const FRAMES: &[char] = &['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
||||
let idx = start_time
|
||||
.map(|st| ((st.elapsed().as_millis() / 100) as usize) % FRAMES.len())
|
||||
.unwrap_or(0);
|
||||
let ch = FRAMES[idx];
|
||||
ch.to_string().into()
|
||||
let blink_on = start_time
|
||||
.map(|st| ((st.elapsed().as_millis() / 600) % 2) == 0)
|
||||
.unwrap_or(false);
|
||||
if blink_on { "•".into() } else { "◦".dim() }
|
||||
}
|
||||
|
||||
impl HistoryCell for ExecCell {
|
||||
|
||||
Reference in New Issue
Block a user