FGRibreau / FGRibreau/spinners

Is there a way to place the spinner on a chosen column?

Open
#19 4 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
602
Forks
29
PR merge metrics
No merged PRs in 30d

Description

Hi,

Say, the second console column, instead of the first one by default. It looks like `SpinnerBuilder` is responsible for customization, but it is unavailable in the `spinners` context. Or is it just my lack of experience?

This example does precisely what I want:
```
extern crate spinner;

use std::time::Duration;
use std::thread;

use spinner::SpinnerBuilder;

fn main() {
let sp = SpinnerBuilder::new("Long Running op!".into()).
format(|sp, status|{
format!(" {spin} -- Currently working on: \'{status}\' -- {spin}",
spin = sp, status = status)
}).start();
thread::sleep(Duration::from_millis(2000));
sp.message("Updating...".into());
sp.update("Fixing things...".into());
thread::sleep(Duration::from_millis(2000));
sp.message("Done!".into());
sp.close();
}
```
The line
```
format!(" {spin} -- Currently working on: \'{status}\' -- {spin}",
```
Is all I need.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.