secretGeek / ok-bash

.ok folder profiles for bash
MIT License
89 stars 6 forks source link

Add fzf support? #11

Closed idanarye closed 5 years ago

idanarye commented 5 years ago

It could be nice if ok had an option to use fzf for picking the command to run.

secretGeek commented 5 years ago

I read about fzf but I don’t really understand what you have in mind. Do you have an example of what it would look like to use ok for picking the command to run, ie a theoretical example of the option and how it would be employed and what it would do.

idanarye commented 5 years ago

For a super basic example, run:

sh -c $(fzf < .ok)

It will open fzf to allow you to pick an action from the .ok file, and run what you picked.

secretGeek commented 5 years ago

That looks like more characters than “ok 2” for example. Maybe I have to try it to see what it’s about.

doekman commented 5 years ago

You can already use an .ok-file with fzf:

eval $(fzf < .ok)

or if you wanted to make the alias OK for it:

alias OK="test -f .ok && eval $(fzf < .ok)"

If you want to echo the executed command, you need to add some code to do this.

So if you want to use this, you can do it now. No need to add this to ok.