~yerinalexey/rex

de8c92b9375823be625ce1ac520e17d70bbdfc1e — Alexey Yerin 4 months ago 1393215
Rewrite documentation

* Use passive voice where possible
* Avoid "regex" and say "input field" instead
* Other style improvements
2 files changed, 19 insertions(+), 19 deletions(-)

M README.md
M main.go
M README.md => README.md +17 -17
@@ 36,30 36,30 @@ e.g. use `make install DESTDIR="$pkgdir" PREFIX=/usr` on Arch and Alpine.
$ rex [flags] [file]
```

Rex reads `file` where each line is a test match (multi-line regexes are not
supported). If not specified, the text is read from standard input. Lines should
be separated by line feeds (`\n`).
Rex reads `file` where each line (separated by line feed, `\n`) is a test match.
If missing, the text is read from standard input.

In the interface you are presented with a regex input field and a list of test
data highlighted accordingly to them matching a regex.
The interface consists of an input field with a regular expression to use, and
the file colored depending on what lines match that regular expression.

You can switch between them using `Tab` or `Shift+Tab`. `Escape` exits the
application and prints input regex to standard output unless `--print-regex=0`
flag is specified.
Those can be switched between using `Tab` or `Shift+Tab`. `Escape` exits the
application and prints the input to standard output unless `--print-regex=0` is
specified.

List can be scrolled using Vi keys: `j` - down, `k` - up. Input field supports
readline-like bindings: [reference].
File matches can be scrolled using Vi keys: `j` - down, `k` - up, etc. Input
field supports readline-like bindings: [reference].

[reference]: https://godocs.io/github.com/rivo/tview#InputField

Flags/options reference:
- `--input REGEX` (`-i REGEX`) - set default value for regex field (`.` if not set)
- `--print-regex` (`-p`) - print regex after exit (`true` by default)
- `--version` (`-V`) - print version number
- `--help` (`-h`) - show help message
The following options are supported:
- `--input REGEX` (`-i REGEX`) - default value for the input field (default: `.`)
- `--print-regex` (`-p`) - print the input after exit (default: `true`)
- `--version` (`-V`) - show version number
- `--help` (`-h`) - show the help message

To turn off boolean flags, you can assign them to a value of zero after an equal
sign: `-p=0` or `--print-regex=false`.
To turn off boolean flags, they can be assigned to `0`
(or other falsy value, see below) with an equal sign: sign: `-p=0` or
`--print-regex=false`.

The following values can be accepted by boolean flags: `1`, `0`, `t`, `f`,
`true`, `false`, `TRUE`, `FALSE`, `True`, `False`.

M main.go => main.go +2 -2
@@ 125,8 125,8 @@ func main() {
	opts := Options{}

	// TODO: More flags
	pflag.StringVarP(&opts.input, "input", "i", ".", "Default value for regex input")
	pflag.BoolVarP(&opts.printRegex, "print-regex", "p", true, "Print regex after exit")
	pflag.StringVarP(&opts.input, "input", "i", ".", "Default value for the input field")
	pflag.BoolVarP(&opts.printRegex, "print-regex", "p", true, "Print the input after exit")
	pflag.BoolVarP(&opts.version, "version", "V", false, "Show version number")
	pflag.BoolVarP(&opts.help, "help", "h", false, "Show this message")
	pflag.Parse()