felangel / felangel/mason

fix(mason_logger) Gracefully handle printing new lines when `Progress` is spinning

オープン
#528 コメント 0 件 リアクション 1 件 担当者 0 名 GitHub で見る
bug
主要言語
Dart
スター
1.1k
フォーク
113
PR マージ指標
30日以内にマージされた PR はありません

説明

**Description**

`print`ing when a progress is active doesn't look good

**Steps To Reproduce**

`dart run` the following file:

```dart
import 'package:mason_logger/mason_logger.dart';

Future main() async {
final log = Logger();

final progress = log.progress('Downloading file');

await Future.delayed(Duration(seconds: 1));

log.info('Text that appears when Progress is spinning');
print('Text that appears when Progress is spinning');
print('Text that appears when Progress is spinning');

await Future.delayed(Duration(seconds: 1));

progress.complete('Downloaded file');
}

```

```
$ dart run bin/demoapp.dart
⠹ Downloading file... (1.0s)Text that appears when Progress is spinning
Text that appears when Progress is spinning
Text that appears when Progress is spinning
✓ Downloaded file (2.0s)
```

**Expected Behavior**

```
$ dart run bin/demoapp.dart
Text that appears when Progress is spinning
Text that appears when Progress is spinning
Text that appears when Progress is spinning
✓ Downloaded file (2.0s)
```

I'd expect the spinner to either always "pop to the bottom" or stay on the line where it was originally printed. This would allow for printing more logs (for example, if the user of my CLI passed a `--verbose` option) while being nice and interactive.

A good example of a tool that handles this issue nicely is Gradle.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。