Skip to content

Fixed -dump flag output and improved search engine argument parsing.#54

Open
drizbit wants to merge 2 commits intotomnomnom:masterfrom
drizbit:master
Open

Fixed -dump flag output and improved search engine argument parsing.#54
drizbit wants to merge 2 commits intotomnomnom:masterfrom
drizbit:master

Conversation

@drizbit
Copy link

@drizbit drizbit commented Jan 5, 2021

  • Changed -dump flag output to show the custom engine (if configured), rather than always showing grep.
  • Fixed handling of the "flags" JSON field when multiple (space-separated) command line arguments are given.

Previously, when passing arguments to the search engine via the "flags"
key in a pattern.json file. the argument would be treated as one single,
long argument by `exec.Command`.

This is fine when passing arguments like `"-rnwE"` (as this is
technically a single argument from the perspective of the shell),
however if "flags" was instead defined as `"-r -n -w -E"`, it would be
passed as one big argument to the search engine, causing errors
(e.g. `"invalid option"` in `grep` and `ag`).

This patch ensures that multiple arguments defined in a pattern.json
file are treated as seperate arguments (e.g. `-r`, `-n`, `-w`, `-E`).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant