Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
39554e7
refactor: remove archive mode
ynqa Feb 26, 2026
f3f5c9f
fix: use crossterm::csi! for defining csi sequences
ynqa Feb 26, 2026
807c51b
docs: understandable for apply_scroll_region
ynqa Feb 26, 2026
2ff7710
docs: try_new
ynqa Feb 26, 2026
53cb475
refactor: draw_pane
ynqa Feb 26, 2026
575e1c9
docs: sync_layout
ynqa Feb 26, 2026
840766b
docs: draw_stream
ynqa Feb 26, 2026
45e8f8d
chore: bump up version to v0.3.0
ynqa Feb 26, 2026
2a1bc09
feat: query editor on header
ynqa Feb 25, 2026
b7dd4cb
chore: capture mouse event to prevent terminal drawing broken
ynqa Feb 25, 2026
75cc332
fix: cargo clippy
ynqa Feb 26, 2026
4f8f4bb
Merge pull request #19 from ynqa/remove-archive-mode
ynqa Feb 28, 2026
5f866b0
cargo: clippy
ynqa Feb 28, 2026
31cf503
Merge pull request #20 from ynqa/sophisticate-terminal
ynqa Feb 28, 2026
033fb6a
fix: remove `mut` for functions with immutable
ynqa Feb 28, 2026
e3690f1
feat: pause/start
ynqa Feb 26, 2026
c93cb5f
docs: Signal => InputAction
ynqa Feb 28, 2026
bc573ac
Merge pull request #21 from ynqa/ctrls
ynqa Feb 28, 2026
1e5a6b1
feat: add a pane for hint
ynqa Feb 28, 2026
9d0e2d3
fix: render correctly when terminal height is 3
ynqa Feb 28, 2026
a01b566
fix: rx.recv() on pause
ynqa Feb 28, 2026
cf78416
fix: pause on tick()
ynqa Feb 28, 2026
730ba94
docs: for tokio::select
ynqa Feb 28, 2026
86187ba
Merge pull request #22 from ynqa/hint
ynqa Feb 28, 2026
0a64a30
feat: enable to customize keybinds and styles
ynqa Mar 1, 2026
0bc3dac
docs: examples
ynqa Mar 1, 2026
8aea773
docs: configuration
ynqa Mar 1, 2026
24c59a8
Merge pull request #23 from ynqa/configure
ynqa Mar 1, 2026
45ec677
chore: bump up promkit version to v0.11.0
ynqa Mar 1, 2026
362f130
Merge pull request #24 from ynqa/promkit-widgets
ynqa Mar 1, 2026
73001a2
chore: use promkit v0.11.1
ynqa Mar 1, 2026
796e7ef
chore: enable mouse capture only on archived mode
ynqa Mar 1, 2026
0526a13
feat: enable to capture only mouse scroll events
ynqa Mar 1, 2026
7245f94
docs: EnableAlternateScrollCapture
ynqa Mar 1, 2026
2f6f3a5
fix: use EnterAlternateScreen and EnableAlternateScrollCapture at cor…
ynqa Mar 1, 2026
7a6e1b7
fix: wrap to leave_terminal and enter_terminal
ynqa Mar 2, 2026
fc405f5
chore: renewal demo (for static files)
ynqa Mar 2, 2026
886dfc4
chore: renewal demo (for streaming)
ynqa Mar 2, 2026
e1a2f28
docs: use demo in ynqa/ynqa
ynqa Mar 2, 2026
518944b
chore: hint using termcfg
ynqa Mar 2, 2026
b1041ea
revert
ynqa Mar 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
269 changes: 209 additions & 60 deletions Cargo.lock

Large diffs are not rendered by default.

13 changes: 9 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sigrs"
version = "0.2.1"
version = "0.3.0"
authors = ["ynqa <un.pensiero.vano@gmail.com>"]
edition = "2021"
description = "Interactive grep (for streaming)"
Expand All @@ -15,16 +15,21 @@ path = "src/main.rs"
[dependencies]
anyhow = "1.0.102"
clap = { version = "4.5.60", features = ["derive"] }
dirs = "6.0.0"
grep = "0.4.1"
promkit = "0.10.1"
promkit = { version = "0.11.1", default-features = false }
promkit-core = "0.2.0"
promkit-widgets = { version = "0.2.0", features = ["texteditor", "listbox"] }
promkit-widgets = { version = "0.3.1", features = ["texteditor", "listbox"], default-features = false }
rayon = "1.11.0"
regex = "1.12.3"
serde = { version = "1.0.228", features = ["derive"] }
strip-ansi-escapes = "0.2.1"
termcfg = { version = "0.2.0", features = ["crossterm_0_29_0"] }
tokio = { version = "1.49.0", features = ["full"] }
toml = "0.9.8"

# The profile that 'cargo dist' will build with
[profile.dist]
inherits = "release"
lto = "thin"
codegen-units = 1
lto = true
90 changes: 73 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Interactive grep

|![sig.gif](https://github.com/ynqa/ynqa/blob/master/demo/sig.gif)|![sig_archived.gif](https://github.com/ynqa/ynqa/blob/master/demo/sig_archived.gif)|
|![sig.gif](https://github.com/ynqa/ynqa/blob/master/demo/sig.gif)|![sig.static.gif](https://github.com/ynqa/ynqa/blob/master/demo/sig.static.gif)|
|---|---|

## Features
Expand All @@ -28,8 +28,8 @@ Interactive grep
and it is possible to switch to a mode
where you can grep through these N entries
based on key inputs at any given moment.
- Additionally, by starting in this mode,
it is also possible to grep through static data such as files.
- For static data such as files, *sig* automatically switches
to archived mode when the input reaches EOF.
- like [ugrep](https://github.com/Genivia/ugrep) with `-Q` option.

## Installation
Expand Down Expand Up @@ -76,7 +76,7 @@ nix shell github:ynqa/sig

Or run it directly:
```nix
cat README.md | nix run github:ynqa/sig -- --archived
cat README.md | nix run github:ynqa/sig
```

### Nix (classic)
Expand Down Expand Up @@ -107,14 +107,9 @@ in
stern --context kind-kind etcd |& sig
# or
sig --cmd "stern --context kind-kind etcd" # this is able to retry command by ctrl+r.
```

### Archived mode

```bash
cat README.md |& sig -a
# or
sig -a --cmd "cat README.md"
# or static input (switches to archived view after EOF)
cat README.md |& sig
```

## Keymap
Expand All @@ -123,6 +118,7 @@ sig -a --cmd "cat README.md"
| :- | :-
| <kbd>Ctrl + C</kbd> | Exit `sig`
| <kbd>Ctrl + R</kbd> | Retry command if `--cmd` is specified
| <kbd>Ctrl + S</kbd> | Pause/Resume stream ingestion
| <kbd>Ctrl + F</kbd> | Enter Archived mode
| <kbd>←</kbd> | Move the cursor one character to the left
| <kbd>→</kbd> | Move the cursor one character to the right
Expand Down Expand Up @@ -156,10 +152,8 @@ $ stern --context kind-kind etcd |& sig
Or the method to retry command by pressing ctrl+r:
$ sig --cmd "stern --context kind-kind etcd"

Archived mode:
$ cat README.md |& sig -a
Or
$ sig -a --cmd "cat README.md"
Static input (switches to archived view after EOF):
$ cat README.md |& sig

Options:
--retrieval-timeout <RETRIEVAL_TIMEOUT_MILLIS>
Expand All @@ -168,16 +162,78 @@ Options:
Interval to render a line in milliseconds.
-q, --queue-capacity <QUEUE_CAPACITY>
Queue capacity to store lines. [default: 1000]
-a, --archived
Archived mode to grep through static data.
-i, --ignore-case
Case insensitive search.
--cmd <CMD>
Command to execute on initial and retries.
-Q, --query <QUERY>
Initial query.
-c, --config <CONFIG_FILE>
Path to the configuration file.
-h, --help
Print help (see more with '--help')
-V, --version
Print version
```

## Configuration

<details>
<summary>The following settings are available in config.toml</summary>

```toml
# Style for matched substrings
highlight_style = "fg=red"

[streaming.editor]
# Query prompt while streaming
prefix = "❯❯ "
prefix_style = "fg=darkgreen"
active_char_style = "bg=darkcyan"
inactive_char_style = ""
# lines =

[streaming.keybinds]
exit = ["Ctrl+C"]
goto_archived = ["Ctrl+F"]
retry = ["Ctrl+R"]
toggle_pause = ["Ctrl+S"]

[streaming.keybinds.editor]
backward = ["Left"]
forward = ["Right"]
move_to_head = ["Ctrl+A"]
move_to_tail = ["Ctrl+E"]
erase = ["Backspace"]
erase_all = ["Ctrl+U"]

[archived.editor]
# Query prompt in archived mode
prefix = "❯❯❯ "
prefix_style = "fg=darkblue"
active_char_style = "bg=darkcyan"
inactive_char_style = ""
# lines =

[archived.listbox]
cursor = "❯ "
# active_item_style =
# inactive_item_style =
# lines =

[archived.keybinds]
exit = ["Ctrl+C"]
retry = ["Ctrl+R"]
up = ["Up", "ScrollUp"]
down = ["Down", "ScrollDown"]

[archived.keybinds.editor]
backward = ["Left"]
forward = ["Right"]
move_to_head = ["Ctrl+A"]
move_to_tail = ["Ctrl+E"]
erase = ["Backspace"]
erase_all = ["Ctrl+U"]
```

</details>
12 changes: 12 additions & 0 deletions assets/sig.static.tape
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Output assets/sig.static.gif

Set Shell "bash"
Set Theme "Dracula"
Set FontSize 28
Set Width 1800
Set Height 1200

Type@50ms "cat README.md | sig" Sleep 1s
Enter Sleep 3s
Type@100ms "sig" Sleep 3s
Type@100ms " | Interactive" Sleep 3s
12 changes: 12 additions & 0 deletions assets/sig.tape
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Output assets/sig.gif

Set Shell "bash"
Set Theme "Dracula"
Set PlaybackSpeed 0.5
Set FontSize 28
Set Width 1800
Set Height 1200

Type@20ms "kubectl -n kube-system logs etcd-kind-control-plane | sig --render-interval 50" Sleep 300ms
Enter Sleep 2s
Type@100ms "info" Sleep 4s
52 changes: 52 additions & 0 deletions default.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Style for matched substrings
highlight_style = "fg=red"

[streaming.editor]
# Query prompt while streaming
prefix = "❯❯ "
prefix_style = "fg=darkgreen"
active_char_style = "bg=darkcyan"
inactive_char_style = ""
# lines =

[streaming.keybinds]
exit = ["Ctrl+C"]
goto_archived = ["Ctrl+F"]
retry = ["Ctrl+R"]
toggle_pause = ["Ctrl+S"]

[streaming.keybinds.editor]
backward = ["Left"]
forward = ["Right"]
move_to_head = ["Ctrl+A"]
move_to_tail = ["Ctrl+E"]
erase = ["Backspace"]
erase_all = ["Ctrl+U"]

[archived.editor]
# Query prompt in archived mode
prefix = "❯❯❯ "
prefix_style = "fg=darkblue"
active_char_style = "bg=darkcyan"
inactive_char_style = ""
# lines =

[archived.listbox]
cursor = "❯ "
# active_item_style =
# inactive_item_style =
# lines =

[archived.keybinds]
exit = ["Ctrl+C"]
retry = ["Ctrl+R"]
up = ["Up", "ScrollUp"]
down = ["Down", "ScrollDown"]

[archived.keybinds.editor]
backward = ["Left"]
forward = ["Right"]
move_to_head = ["Ctrl+A"]
move_to_tail = ["Ctrl+E"]
erase = ["Backspace"]
erase_all = ["Ctrl+U"]
Loading
Loading