Skip to content

Commit

Permalink
Merge pull request #4 from kattouf/static-text-option-2
Browse files Browse the repository at this point in the history
Static text option 2
  • Loading branch information
kattouf authored Sep 2, 2024
2 parents 197fdf6 + 4de863d commit 120aec3
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 9 deletions.
22 changes: 13 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ long-running-command 2>&1 | progressline

## Features

### Change Activity Indicator Styles
### Change activity indicator styles

**ProgressLine** offers different styles to represent activity, they can be changed using `-s, --activity-style` argument:
ProgressLine offers different styles to represent activity, they can be changed using `-s, --activity-style` option:

``` sh
long-running-command | progressline --activity-style snake
Expand All @@ -47,21 +47,25 @@ Available styles:
|:--:|:--:|:--:|
| ![](./.github/activity_style_dots.gif) | ![](./.github/activity_style_snake.gif) | ![](./.github/activity_style_kitt.gif) |

### Replace log output with custom text

If you don't need to see the log output during execution, even in a single line, you can replace it with your own text using the `-t, --static-text` option.

``` sh
long-running-command | progressline --static-text "Updating sources..."
```

### Highlight important lines

Log specific stdin lines above the progress line using the `-m, --log-matches` argument:
Log specific stdin lines above the progress line using the `-m, --log-matches` option:

``` sh
long-running-command | progressline --log-matches "regex-1" --log-matches "regex-2"
```

| output |
|:--:|
| ![](./.github/progressline_matches_output.png) |

### Use progress line as an addition to standard output

Log all stdin data above the progress line using the `-a, --log-all` argument:
Log all stdin data above the progress line using the `-a, --log-all` option:

```sh
long-running-command | progressline --log-all
Expand All @@ -77,7 +81,7 @@ You have two options for saving the full original log:
long-running-command | tee original-log.txt | progressline
```

2. Using `-l, --original-log-path` argument:
2. Using `-l, --original-log-path` option:

``` sh
long-running-command | progressline --original-log-path original-log.txt
Expand Down
2 changes: 2 additions & 0 deletions Sources/ProgressLineController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ final actor ProgressLineController {

func didGetStdinDataChunk(_ data: Data) async {
guard case .stdin = textMode else {
// we will redraw anyway to sync (prevent flickering) with other log controllers
await redrawProgressLine()
return
}

Expand Down
30 changes: 30 additions & 0 deletions Tests/snapshots/static_text.snapshot
Original file line number Diff line number Diff line change
@@ -1,2 +1,32 @@
<activity> <duration> ❯ Static text
<activity> <duration> ❯ Static text
<activity> <duration> ❯ Static text
<activity> <duration> ❯ Static text
<activity> <duration> ❯ Static text
<activity> <duration> ❯ Static text
<activity> <duration> ❯ Static text
<activity> <duration> ❯ Static text
<activity> <duration> ❯ Static text
<activity> <duration> ❯ Static text
<activity> <duration> ❯ Static text
<activity> <duration> ❯ Static text
<activity> <duration> ❯ Static text
<activity> <duration> ❯ Static text
<activity> <duration> ❯ Static text
<activity> <duration> ❯ Static text
<activity> <duration> ❯ Static text
<activity> <duration> ❯ Static text
<activity> <duration> ❯ Static text
<activity> <duration> ❯ Static text
<activity> <duration> ❯ Static text
<activity> <duration> ❯ Static text
<activity> <duration> ❯ Static text
<activity> <duration> ❯ Static text
<activity> <duration> ❯ Static text
<activity> <duration> ❯ Static text
<activity> <duration> ❯ Static text
<activity> <duration> ❯ Static text
<activity> <duration> ❯ Static text
<activity> <duration> ❯ Static text
<activity> <duration> ❯ Static text
✓ <duration> ❯ Static text

0 comments on commit 120aec3

Please sign in to comment.