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

fzy: either allow -q to have no argument or accept any string as -q #15

Closed
gauteh opened this issue Jun 2, 2016 · 2 comments
Closed

Comments

@gauteh
Copy link

gauteh commented Jun 2, 2016

I am trying to set up an alias like:

alias fzyfind=find . | fzy

but if I want to start with a query I have to specify the -qoption, and I cannot add it to the alias because then I cannot use the alias without specifying a start query.

Is the -q option necessary? Could not the argument that is not an option just always be the intital query?

@jhawthorn
Copy link
Owner

I think it is best if an argument is required. It's weird that -q would "work" but have no meaning. However, -q can accept an empty string as an argument.

You should be able to achieve what you want using a shell function instead of an alias

fzyfind() {
  find . | fzy -q "$*"
}

This uses any arguments to fzyfind as input to -q. If none are provided it is equivalent to -q ""

fzyfind -> find . | fzy -q ""
fzyfind foo -> find . | fzy -q "foo"
fzyfind foo bar -> find . | fzy -q "foo bar"

@gauteh
Copy link
Author

gauteh commented Jun 5, 2016

John Hawthorn writes on juni 5, 2016 9:51:

I think it is best if an argument is required. It's weird that -q would "work" but have no meaning. However, -q can accept an empty string as an argument.

Right, that works of course :)

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

2 participants