Handy Extension Handler
Developed by: Jeremy Doolin
Kyle Wheeler
Current Version: 1.4.0

Sourceforge File List



SourceForge Logo

Powered by PHP

Well, this isn't exactly what is shown on most documentation pages. It's more or less a page dedicated to using heh. There's a bit more to it than meets they eye, so here is how you use heh:

Opening a file

If you want to open a file (primary use of heh), type:
heh filename
For example:   heh foo.pl
heh ~/projects/perl/foo.pl
heh foo.pl bar.tex .bashrc *.gif
If heh does not have that particular extension or type in its database, it will prompt the you for an application.

For inline database updating and opening type:

heh -i xfig foo.fig

This will update the database and open the file in one command.

Updating the Database

Updating the database can be done in several ways. The primary ways (adding to and editing) are:
  • opening a file with an unrecognized extension (as stated above)
  • the -u option
  • the -i option (inline)
I've already described the -i option. Here are the other ways:

a simple update:   heh -u ps gv

This tells heh to open all files with extension ps to be opened with gv. This can both change or add to the database.

You can set certain extensions to be associated or equivalent. For instance, we all know that foo.html and foo.htm are the same thing. So lets have them be opened by the same application. For all you C++ programmers out there, you know that a bar.h, bar.cc, and bar.template are associated (and have the same syntax). So here's how you tell heh that they're equivalent:

heh -e htm html
heh -e cc h template

This tells heh to open the files with the same application. However, one of the extensions must already be in the database. (perhaps that should be changed...) Also, if more than one of those applications is already defined in the database, they will all be set equivalent to the FIRST one that's defined in that list (they'll all still be equivalent, but they'll be opened with the application that the first one in the list was set to be opened with).

If you have associated extensions and would like to change the application for all of them, here's how:

heh -ua cc xjed

This tells heh to open all files with an extension associated with cc (perhaps h, template, cpp, C) to be opened with xjed. If you don't use the -ua (update all) option, it will only change the cc extension's entry in the database.

To remove an entry or entries from the database:

heh -r c CC h mp3

This will remove ONLY these extensions from the database, NOT any of their associated extensions (if any).

To set certain extensions to be ignored (such as bak or old):

heh -ie old bak whatever

This tells heh to ignore the bak, old, and whatever extensions when looking for the 'real' filename extension. For instance, foo.pl.bak will be opened as foo.pl. heh does this recursively, so foo.pl.back.old.whatever will still be opened as foo.pl.

Remember, the ~/.extensions file can always be edited by hand for even more complicated user-specific details!!

Querying the database

To query an extension or extensions:

heh -qe c CC fig ps

This will print to the screen the applications that open those extensions and will inform the user if it is not in the database.

To query an appliation or applications:

heh -qp xjed xfig xmms gv

This will print all extensions opened by those applications. It will inform the user if the applications is not used.

To print out everything in the database:

heh -qa

This prints a list of all extensions and applications in the database. For any of these queries, you can (optionally) tell heh which database to query (term, X, or both).

heh -qe -X pl pro
heh -qe -term txt dat
heh -qa -both

Other options

To view the current version number:

heh -v
heh --version

To view the help menu:

heh -h
heh --help

Pseudo extensions and applications

There are some files that have no extension or are not exactly a file. We have incorporated them into heh as pseudo extensions:
  • .NOEXTENSION_T - This is a text file with no extension or a dotfile that is text only.
    For example:   heh ~/.bashrc
    heh README
  • .NOEXTENSION_B - These are files without extensions that are binary (and thus will not be opened).
    For example:   heh /bin/bash
  • .DIRECTORY - This is for opening directories.
    For example:   heh ~
  • .URL - If you would like to open anything of the form http://, file://, ftp://, etc.
    For example:   heh http://www.google.com
  • .MAILTO - Filenames of the form mailto:
    For example:   heh mailto:jdoolin@cs.ohio.edu
There are some applications that we have provided to give heh that aren't really applications:
  • _.IGNORE._ - ignores files with the given extension
  • _.EXTIG._ - does not ignore the file, but ignores the extension. For example, if you tell heh to open files of extension bak with _.EXTIG._, heh will ignore the .bak and use the rest of the filename (foo.pl.bak will be opened with the application for pl files).
  • _.SCRIPT_ALIAS._ - this isn't really a valid handler, but You can write shell scripts in the /etc/extensions_aliases (as root of course). We have provided three (one for .URL's, one for .DIRECTORY's and one for .MAILTO's) for convenience and as examples.

This page last modified May,29 2001