Skip to content
This repository has been archived by the owner on Jun 9, 2021. It is now read-only.

rethink commands to allow any number of args #26

Closed
mvdan opened this issue Oct 24, 2017 · 1 comment
Closed

rethink commands to allow any number of args #26

mvdan opened this issue Oct 24, 2017 · 1 comment

Comments

@mvdan
Copy link
Owner

mvdan commented Oct 24, 2017

Right now, commands are always of the form -A expr. I propose that we redesign them so that any number of arguments may be used.

For example, let's say that we want to add a command that lets us control how many occurences of a match we want to have. For example, -c '>= 2' expr. Then, -g expr would be short for -c '> 0' expr, and -v expr would be short for -c '== 0' expr.

If we are to allow any number of arguments, we should drop the notion of flags entirely, as they typically only allow 0 or 1 values. I still think a preceding character other than - would be useful to visualise the start of these chained commands.

I propose ., for example:

gogrep .x expr1 .c '>= 2' expr2

Suggestions of more commands that would use more information than an expression to match are welcome.

@rogpeppe thoughts?

@mvdan
Copy link
Owner Author

mvdan commented May 10, 2018

I'm not going to do this. Instead, gogrep will expose a nice API to write complex queries as Go code. In a way that would resemble writing a linter, but in a much simpler and higher-level way, while also having full access to custom logic via Go code.

@mvdan mvdan closed this as completed May 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant