Skip to content

Commit 77a88c9

Browse files
authored
docs: readme update (#9)
1 parent 1e0a3b3 commit 77a88c9

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

README.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@
44
[![Crates.io](https://img.shields.io/crates/v/grits.svg)](https://crates.io/crates/grits)
55
[![Crates.io](https://img.shields.io/crates/d/grits)](https://crates.io/crates/grits)
66

7-
`grits` is a minimal, simple, easy-to-use line text-processor that applies regular expressions with named captures to input lines
7+
`grits` is a minimal, simple, and easy-to-use line text-processor that applies regular expressions with named captures to input lines
88
and transforms them using a custom template string. It allows for efficient parsing, extracting, and formatting of text,
99
including support for colorization and other attributes you'd get using ANSI escape sequences.
1010

11-
The following example demonstrates how to apply `grits` to `tcpdump` to extract a packet's source IP address:
11+
The following example demonstrates how to apply `grits` to `tcpdump` to extract a packet's source (`src`) and destination (`dst`) IP address:
1212

1313
```bash
14-
tcpdump | grits -p '^(?<ts>[^ ]+)' \
14+
sudo tcpdump -nn | grits -p '^(?<ts>[^ ]+)' \
1515
-p 'IP\w? (?<src>[^ ]+)' \
16-
-t '[${(cyan|bold):ts}] ${(green|underlined):"src"}=${src || "NOMATCH"}'
17-
16+
-p '> (?<dst>[^ ]+):' \
17+
-t '[${(cyan|bold):ts}] ${(green|underlined):"src"}=${src} ${(yellow|underlined):"dst"}=${dst}'
1818
```
1919

2020
![demo image](images/demo.png)
21-
The left pane in the above screenshot is the raw output of `tcpdump` while the right pane shows the output being piped into `grits`.
21+
The top pane in the above screenshot is the raw output of `tcpdump` while the bottom pane shows the output being piped into `grits`.
2222

2323
## Table of Contents
2424

@@ -49,7 +49,8 @@ Arguments:
4949
Options:
5050
-p, --pattern <PATTERN> A regular expression with named captures. Can be specified multiple times
5151
-t, --template <TEMPLATE> A template string that defines how to transform a line input. See long '--help'
52-
--line-buffered Force output to be line-buffered. By default, output is line buffered when stdout is a terminal and block-buffered otherwise
52+
-r, --require <REQUIRE> Name of capture that must have at least one match for the output to show. Can be specified multiple times
53+
--line-buffered Force output to be line-buffered. By default, output is line buffered when stdout is a terminal and block-buffered otherwise
5354
-c, --completions <COMPLETIONS> Produce completions for shell and exit [possible values: bash, elvish, fish, powershell, zsh]
5455
-h, --help Print help (see more with '--help')
5556
-V, --version Print version
@@ -68,13 +69,13 @@ cargo install grits
6869
### cURL
6970

7071
```bash
71-
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/solidiquis/grits/releases/download/v0.1.0/grits-installer.sh | sh
72+
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/solidiquis/grits/releases/download/v0.2.0/grits-installer.sh | sh
7273
```
7374

7475
### Powershell
7576

7677
```bash
77-
powershell -ExecutionPolicy Bypass -c "irm https://github.com/solidiquis/grits/releases/download/v0.1.0/grits-installer.ps1 | iex"
78+
powershell -ExecutionPolicy Bypass -c "irm https://github.com/solidiquis/grits/releases/download/v0.2.0/grits-installer.ps1 | iex"
7879
```
7980

8081
### Manual installation
@@ -94,7 +95,7 @@ echo 'level=info msg=foobar path=/baz' | grit -p 'msg=(?<log>[^ ]+)' -o 'transfo
9495
```
9596

9697
In this command, we use a regular expression to capture the value associated with the msg field.
97-
The capture group is named log. The template string `transformed=${log}` will replace `${log}` with
98+
The capture group is named `log`. The template string `transformed=${log}` will replace `${log}` with
9899
the value captured from the input. The output will then be:
99100

100101
```

images/demo.png

-370 KB
Loading

0 commit comments

Comments
 (0)