coding/fuzzy

fuzzy is a platform independent program, which enables you to specify parameters of other programs in a fuzzy way.
The idea is to let fuzzy parse those fuzzy parameters to specific ones and pass those to the real application.
Fuzziness is achieved by specifying parameters of applications to match certain regular expressions.
As parameters of applications can be very different (paths, process names, ...) fuzzy provides different kinds of tags to process different kind of parameters.
Each tag is processed and replaced by its specific result, which is then passed to the real application.
Each tag can also have a different set of options.
fuzzy mostly intends to speed up everyday command-line work.

features

usage examples

You can use fuzzy in 2 ways: Either directly in your own shell scripts or indirectly by using the provided shell scripts in the example folder. The following assumes, that you correctly installed fuzzy and all of the (locate-based) examples. If you want to use fuzzy in your own shell scripts, you should have a look at the fuzzy documentation (simply call fuzzy without arguments or read MANUAL.txt).

It also assumes, that you're having a copy of the bourne-again shell (bash) at /bin/bash and the tool "locate" installed (usually at /usr/bin/locate). If you don't use bash, fuzzy should work for your system (if your shell is powerful enough), but you'll have to write the shell scripts that use fuzzy yourself. In the case of Windows systems I assume, that cmd.exe isn't powerful enough. The Windows PowerShell might work, but I didn't test neither of these two. If you do, please tell me.

You can also run fuzzy without locate, but that should make things much slower.

So: Let's assume a directory structure such as "~/Desktop/examplefolder/examplesubfolder1/examplesubfolder2". You ran updatedb after having created those folders. examplesubfolder contains a file named "text.txt", a file "big_buck_bunny.txt" and a file "big_buck_bunny_480p_h264.mov". The current working directory of your shell (pwd) doesn't matter.

Now you want to edit the file "big_buck_bunny.txt":
vimf buck*bunny*txt
(alternatively you could use: geditf buck*bunny*txt)
This takes 2-3 seconds on my machine, but should be faster than typing vim ~/Desktop/examplefolder/examplesubfolder1/examplesubfolder2/*bunny.txt

To play the movie, you could use:
vlcf buck*bunny
Note that the file extension can be omitted this time as the vlcf script contains a regular expression, that only matches video files.

Now an interesting case: You probably have some other file with "text" in its name on your computer. So a simple "vimf text" wouldn't suffice.
You'll probably have to use:
vimf example/text.txt
(or geditf example/text.txt respectively)

To change to the folder "examplesubfolder2", you might use:
cdf examplesub*2
(cdf being an alias to the fuzzy_cd script in the example folder - see that script for further details)

If you don't like the fact, that "cdf example" will get you elsewhere, simply add the line "~/Desktop/examplefolder/examplesubfolder1/examplesubfolder2" to the file "~/.fuzzy/preferred/path.prm". Afterwards "cdf example" will get you to the desired folder.

All of the previous examples used the fuzzy path tag. However there's also the fuzzy custom tag:

renicef -n -15 *fox*
would renice ALL processes with names matching the regex "*fox*" to priority -15

mpcfindf maiden
will present you a list with all mpc songs in your current playlist matching the regex "*maiden*" and ask you to select one of these songs for playback

shuff -n 1 file | mpcjumpf
executes shuf -n 1 on a text file matching the regex "*file*" (i.e. chooses a random line from that file) and then looks for a song matching that line to make mpd play it (feeding to stdin is a new feature in fuzzy version 0.85)

If that's not enough for you, there's still more examples to be found in the example folder and you can freely implement your own ideas in new scripts.

summary

versionplatformlicenselanguagedependenciestranslationsuser interfacemaintaineddownloadtype
1.0independentGPLv3C++≥ Qt 4.6 (optional: locate)Englishconsoleyeslaunchpad.netsource