CLI Magic: A OneFinger salute

46

Author: Joe Barr

Put down your coffee cups before reading this. CLI Magic this week is about a GUI program. Hey, I know it sounds bizarre, but I had to give it a try. I saw a blurb about OneFinger — a GUI application for creating commands for the CLI — on freshmeat.net finally being usable. What the heck, it might be the only way some people ever learn to use the CLI. So I decided to check it out.

There are prerequisites. You’ll need to have the PyQT and PyKDE libraries, konsole, kdesu, and kde-devel. There are two parts to the puzzle: the OneFinger core and the OneFinger applet. After you take care of any missing prerequisites, you can get started by downloading both from the website.

Prerequisites

I needed to install SIP, PyQT, and PyKDE. Luckily, they are all on the same website. Installation consisted of the same following three steps for each, with make install being run as root.


>python configure.py
>make
>make install

The SIP installation went smoothly. PyQT did too, except that its make took a very long time to run: close to 45 minutes. The PyKDE install failed because of a missing kde-devel. Once I had that piece of the puzzle in place, PyKDE installed without complaint. All I had to do was wait, because — just like PyQT — it seemed to take forever. About half an hour for PyKDE. Naturally, build time on your machine will vary due to differences in horsepower and work load.
Finally, with all the prerequisites finally out of the way, it was time to install Onefinger.

Installing OneFinger

After decompressing onefinger-core, installation was as easy as entering the following:


./configure --prefix=/opt/kde3
make
make install

As usual, make install must be run as root. Then do the same thing to install the application kicker.

(as root, by the way) python install.py. Ditto for application kicker. Then it was time to to give it a whirl. I entered one-finger at the command line. It said:

resourceDir = /usr/share/OneFinger
parser_file_dir = /usr/share/OneFinger/src
imgDir = /usr/share/OneFinger/img/
Traceback (most recent call last):
  File "/usr/bin/one-finger", line 1530, in ?
    , misc_toolbar)
  File "/usr/share/OneFinger/src/my_qt_widgets.py", line 160, in
__init__
    QToolButton.__init__(self, icon, text, group_text, callback, parent)
TypeError: argument 1 of QToolButton() has an invalid type
KCrash: Application 'one-finger' crashing...
OneFinger: ERROR: Communication problem with OneFinger, it probably
crashed.

Click to enlarge

Checking the mailing list and the change log on the OneFinger site, I found mention of this problem and a new release to fix it. Sure enough, after downloading and installing the latest core and kicker, I was able to start OneFinger — and even install the application kicker as a button on my desktop panel — without a problem.

Clicking on my shiny new OneFinger icon brought up not one, but two new windows. On top was a OneFinger window list, which showed all my currently active windows. After minimizing that, I was finally at the good stuff, the main OneFinger screen.

A toolbar across the top allows you to save the current database, rescan programs found in the path, add a directory to a list of “important” directories, remove a directory from that list, a couple whose function escape me completely, a “drop here” icon, and a “drag to” as well.

Beneath that toolbar is a window marked with an X inside an arrow. It is pointing at the command that you build with this app. To me it’s a little bit unreal, a little bit over the top: it’s a visual IDE for the CLI.

Beneath the command under construction window are three panels: on the left is a directory tree, in the middle a listing of programs found in the path, and on the right a history of recently used commands.

But what’s the point?

Per the OneFinger entry on freshmeat.net, the point is this:

OneFinger is a general-purpose GUI for composing CLI commands with the mouse. Although entirely graphical, it does not attempt to hide the underlying CLI language. It increases your productivity over classical hand-typing by caching commands typed into terminals, which tend to be highly repetitive. Repeated commands can be selected from a list, ordered by last usage time. It includes an integrated file browser that helps you insert filenames without typing them. and allows you to see only those programs that make sense with a given file.

Does it work? Yes, pretty much so. I used Onefinger to create the following command in order to spell check this column:


aspell -c cli:onefinger.txt

OneFinger threw some extraneous “/home” strings into the command line as I navigated in the left panel to find the directory where the text file lives, and I did have to manually type the -c argument. But after cleaning up the “/home? strings, I was able to click on the Execute button and have it run the command just as if I had entered it at the keyboard instead of the mouse. Not only that, it saved the command for me in case I ever need to spellcheck the same file again.

Now obviously, this is not a project written for the likes of me. I have taken a completely different approach to demystifying the CLI: I blather about it. But for those who were raised in the GUI, perhaps it is of use. As different as OneFinger and I are, we both agree that being able to get to the CLI and have our way with it is a good thing.

The OneFinger project is fairly new, and the author needs people to try it and use it and provide him with feedback. If you’re looking for a GUI way out of entering commands, give it a try.