ebee649149a838ebbcc4a43874b8eda36048e186 — Alexey Yerin 3 months ago fb6f34b
Default --print to false
2 files changed, 3 insertions(+), 8 deletions(-)

M main.go
M README.md => README.md +2 -7
@@ 43,8 43,7 @@ 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.

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

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

@@ 53,14 52,10 @@ field supports readline-like bindings: [reference].

The following options are supported:
- `--input REGEX` (`-i REGEX`) - default value for the input field (default: `.`)
- `--print` (`-p`) - print the input after exit (default: `true`)
- `--print` (`-p`) - print the input after exit (default: `false`)
- `--version` (`-V`) - show version number
- `--help` (`-h`) - show the help message

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

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

M main.go => main.go +1 -1
@@ 126,7 126,7 @@ func main() {

	// TODO: More flags
	pflag.StringVarP(&opts.input, "input", "i", ".", "Default value for the input field")
	pflag.BoolVarP(&opts.printOnExit, "print", "p", true, "Print the input after exit")
	pflag.BoolVarP(&opts.printOnExit, "print", "p", false, "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")