http://github.com/DerGuteMoritz/eff-the-finder/
Eff is a command line interface to various search engines. To get an overview of available search engines (called finders
in Eff’s terminology), just type f
in your terminal:
f
Currently, Eff ships with finders for Google, IMDB, Pirate Bay, Shoutcast.com, YouTube and APIdock. You can also easily create your own finders (see Creating Finders below).
To search Google, type
f google rickroll
You might as well just give the first few distinctive characters of the finder’s name, so unless you have defined another finder starting with g
, this is equivalent to the above:
f g rickroll
Voilá, the first 10 Google hits for rickroll:
1. Rickrolling - Wikipedia, the free encyclopedia 2. YouTube - RickRoll'D 3. YouTube - Rick Roll: The Literal Version 4. Urban Dictionary: rickroll 5. Rick Roll. You Got Rick Rolled 6. Rickroll - Encyclopedia Dramatica 7. Rick Astley  Wikipedia 8. YOU GOT RICK ROLL'D 9. Rickroll Database: never get rickroll'd again 10. Rick Roll It!
Great, what now? Below the list of results you are greeted with Eff’s prompt, waiting for further instructions:
f >
You may press return
to get a list of available commands. There are 6 basic commands (one of them q
for quit) which are available for all finders. However, finders may specify their own commands so taking a look at the command overview is always a good idea.
Now, first of all, there are n
and p
for turning to the next and previous pages. If you forgot which page you’re on, l
will remind you by printing the results of the current page again.
Of course, the interesting part is interacting with the results. At the moment, there are 2 basic interaction commands: f
opens the given result in your web browser (using copiousfreetime.rubyforge.org/launchy/) and o
allows you to pass the result name or URI to an arbitrary shell command. Results are identified by their numeric index, so to open the Wikipedia article on Rickrolling from the result page above in your web browser you’d type:
f > f 1
The space is optional for result index arguments. Also, every finder may define a default command to be executed on result items which is run whenever you type nothing but a result index. The default default command is f
, so unless your current finder overrides the default (which the google finder doesn’t), this is equivalent to the example above:
f > 1
The o
command is similar but it requires a command string after the result index. Within the command string, you may use the placeholders %u
and %n
which are substituted by the selected result’s URI and name. For example, this:
f > o1 echo %u
(note the omitted space after o
) would output:
http://en.wikipedia.org/wiki/Rickroll
Creating your own finders is very easy. Take a look at lib/f/finder/*.rb
for examples. A more detailed how-to will be available soon. Note that Eff will auto-require $HOME/.f/*.rb
on startup, so this is a good place for your code.
gem install DerGuteMoritz-eff-the-finder --source http://gems.github.com
(The MIT License)
Copyright © 2009 Moritz Heidkamp
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.