0576f7bdd123d63212648577dd67d18bfaa5c7fc — Alexey Yerin 5 months ago 2c14faf
Add -no-print option to prevent printing regex
2 files changed, 9 insertions(+), 2 deletions(-)

M main.go
M README.md => README.md +2 -1
@@ 28,7 28,8 @@ In the interface you are presented with a regex input field and a list
of test data highlighted accordingly to them matching a regex.

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

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

M main.go => main.go +7 -1
@@ 36,6 36,9 @@ type Options struct {

	// Default value for regex input
	input string

	// Do not print regex after exit
	noPrint bool

func fatalf(format string, v ...interface{}) {

@@ 110,6 113,7 @@ func main() {

	// TODO: More flags
	flag.StringVar(&opts.input, "input", ".", "Default value for regex input")
	flag.BoolVar(&opts.noPrint, "no-print", false, "Do not print regex after exit")
	flag.BoolVar(&opts.help, "help", false, "Show this message")

@@ 180,7 184,9 @@ func main() {
		case tcell.KeyEscape:

			if !opts.noPrint {
		case tcell.KeyTab:
			move = 1
		case tcell.KeyBacktab: