-
-
Notifications
You must be signed in to change notification settings - Fork 168
Loading animation for deployments #724
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4 files reviewed, 1 comment
| print!("\r"); | ||
| std::io::Write::flush(&mut std::io::stdout()).unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Line clear may not fully erase long spinner messages. Use ANSI escape code to clear entire line.
| print!("\r"); | |
| std::io::Write::flush(&mut std::io::stdout()).unwrap(); | |
| print!("\r\x1B[2K"); | |
| std::io::Write::flush(&mut std::io::stdout()).unwrap(); |
Prompt To Fix With AI
This is a comment left during a code review.
Path: helix-cli/src/utils.rs
Line: 418:419
Comment:
**style:** Line clear may not fully erase long spinner messages. Use ANSI escape code to clear entire line.
```suggestion
print!("\r\x1B[2K");
std::io::Write::flush(&mut std::io::stdout()).unwrap();
```
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're absolutely right! The syntax in my suggestion was incorrect. The ANSI escape code should be a string literal, not separate parts. Here's the corrected version:
| print!("\r"); | |
| std::io::Write::flush(&mut std::io::stdout()).unwrap(); | |
| print!("\r\x1B[2K"); | |
| std::io::Write::flush(&mut std::io::stdout()).unwrap(); |
The \x1B[2K is the ANSI escape sequence that clears the entire current line, ensuring that any leftover characters from longer spinner messages are completely erased before the cursor returns to the beginning of the line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.

Description
Added a spinner as sign of loading animation for deployments in CLI
Related Issues
#705
Closes #705
Checklist when merging to main
rustfmthelix-cli/Cargo.tomlandhelixdb/Cargo.tomlAdditional Notes
Here is a quick video
Screencast from 2025-11-25 14-25-14.webm
Greptile Overview
Greptile Summary
Implemented loading spinner animation for CLI deployment operations to address user feedback that the terminal appeared frozen during builds.
Key changes:
Spinnerstruct inutils.rswith async animation using tokiobuild.rspush.rswith provider-specific messagesdocker.rsto avoid interfering with spinnerImplementation details:
Arc<Mutex<String>>for thread-safe message updatesImportant Files Changed
File Analysis
Spinnerstruct with async animation loop using tokio, includes proper cleanup via Drop traitbuild_imagecall with start/stopbuild_image, delegating user feedback to spinner in calling codeSequence Diagram
sequenceDiagram participant User participant BuildCmd as build.rs participant PushCmd as push.rs participant Spinner participant Docker as docker.rs participant CloudProvider Note over User,CloudProvider: Build Command Flow User->>BuildCmd: helix build BuildCmd->>Spinner: new("DOCKER", "Building...") BuildCmd->>Spinner: start() activate Spinner Note right of Spinner: Tokio task spawned<br/>Animation loop running BuildCmd->>Docker: build_image() Docker-->>BuildCmd: Result BuildCmd->>Spinner: stop() deactivate Spinner Note right of Spinner: Task aborted<br/>Line cleared BuildCmd-->>User: Success message Note over User,CloudProvider: Push Command Flow (Cloud) User->>PushCmd: helix push PushCmd->>Spinner: new("BUILD", "Building instance...") PushCmd->>Spinner: start() activate Spinner PushCmd->>BuildCmd: run() BuildCmd->>Docker: build_image() Docker-->>BuildCmd: Result BuildCmd-->>PushCmd: MetricsData PushCmd->>Spinner: stop() deactivate Spinner PushCmd->>Spinner: new("DEPLOY", "Deploying instance...") PushCmd->>Spinner: start() activate Spinner PushCmd->>Spinner: update("Deploying to Fly.io/ECR/Helix...") Note right of Spinner: Message updates<br/>while animating PushCmd->>CloudProvider: deploy() CloudProvider-->>PushCmd: Result PushCmd->>Spinner: stop() deactivate Spinner PushCmd-->>User: Success message