Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to find an approximate match by popping the pattern list #40

Closed
baskerville opened this issue Dec 6, 2011 · 5 comments
Closed

Try to find an approximate match by popping the pattern list #40

baskerville opened this issue Dec 6, 2011 · 5 comments

Comments

@baskerville
Copy link
Contributor

If z foo bar baz yields no matches and if z foo bar does, I'd like to be taken to that match when I isssue the first command.

So, I think it would be a good idea to pop the tokens list until either it's empty or a match was found.

@rupa
Copy link
Owner

rupa commented Dec 8, 2011

I'm not into this. z is already kind of borderline with regard to Doing What You Expect, and I think this functionality would make it less obvious what to expect, rather than more.

I'll leave this open for a while, in case anyone else wants to opine, but for now I'm not

@orefalo
Copy link

orefalo commented Dec 8, 2011

IMHO, the functionality described above is nice, yet it shall be built into a different project. I recall reading something... let me try to find it.

@baskerville
Copy link
Contributor Author

Maybe the behavior could be enabled through an environment variable and disabled by default.

@malexmave
Copy link

Sorry for necro, I typed this all up before seeing the last post is 5 months in the past, and don't want to let it go to waste.

What happens if you type z foo bar baz and you would get a match on z bar baz (so the foo is the offender)? Your method of popping from the end would still yield no proper results if I understand it correctly.

So you would have to remove a parameter, check if you get a match, if not, put it back and check the next, if you don't get a match on any of them, start removing two params, ...

You could probably do that, but it's not very friendly.

I don't know how the list of results is generated, but if it works using some kind of ANDs on the results, you could add a switch that tells z to match using OR instead of AND, making parameters optional, if you understand what I mean.

@rupa
Copy link
Owner

rupa commented Jun 8, 2012

Arguments are treated as regular expressions, and they are ANDed together. it's perfectly feasible to have a single argument with regex or in it e.g. z a\|b matches on a OR b

@rupa rupa closed this as completed Feb 14, 2015
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

No branches or pull requests

4 participants