FGRibreau / FGRibreau/spinners

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

未關閉
#19 4 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
enhancement
主要語言
Rust
星號
602
分支
29
PR 合併指標
30 天內沒有已合併 PR

描述

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.

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。