07/29/11 21:30:05

oft: Bash function for opening a specific filetype

This looks great. Brett has written a Bash function that allows you to open a specific file by typing its extension, rather than its filename. This is helpful when you have tons of files in a directory and can’t remember a files’ name, but know there’s only one file with that extension. Brett writes:

My most obvious use case is Xcode projects, where I may have dozens (and dozens) of files, but there’s only one .xcodeproj file (folder). I don’t always know the name of the project in the folder, but if I run oft xco it will open it without my having to search. If there is more than one result, it gives you a numeric menu to select the file you want to open. You can cancel, select a single file or “Open ALL” from that menu. If you run oft with no arguments, it will read a (partial) extension from a prompt.

Check it out on his blog.