History and auto-completion with rlwrap 4

Posted by F 18/01/2007 at 23h06

If you ever used Oracle’s sqlplus you’d agree that it provides an arcane command-line interface.

Being a textmode command-line tool is not what makes it arcane though. It’s that it doesn’t offer auto-completion or a command history. If you made a small mistake when typing a long statement, you would have to re-enter it all over again.

Most modern command-line tools (including MySQL and PostgreSQL’s equivalent to Oracle’s sqlplus) provide much more powerful interfaces, just like the bash shell does. They include auto-completion of the text you are typing (by pressing TAB), access to a history of commands (up/down arrows, or C-p/C-n), incremental search on the history (C-r), they remember the history in between invocations and more. Virtually all these tools use the GNU readline library to provide these capabilities.

Unfortunately, not all command-line tools use GNU readline (splplus being one). Fortunately, there’s rlwrap. I just came to know this nice little tool.

rlwrap “wraps” any other command-line tool and gives you a readline interface to it. So, you can invoke rlwrap sqlplus and you get sqlplus with the history capabilities of the readline library.

You may also pass to rlwrap a list of potential words to use for completion. For example, I also use rlwrap with groovysh (the Groovy language shell), so I created a file “~/.groovysh_completions” containing the list of commands groovysh accepts. Now, when I launch groovysh I get command history and specialized auto-completion.

Now, rlwrap cannot do magic. Being so generic, it cannot do intelligent context-dependent auto-completion. For instance, PostgreSQL’s command-line interface automatically pulls the list of potential table names after doing SELECT * FROM <TAB>. rlwrap cannot give this intelligence to sqlplus, but it’s still much better than nothing.

AntDoclet 1.1

Posted by F 22/07/2006 at 16h43

I just released a new version of AntDoclet.

No major changes. Now the comments of inherited methods are properly extracted from the parent class comments.

Thanks to Daniel Lindner for this fix.

GotAPI?

Posted by F 12/04/2006 at 22h16

Did you know about gotAPI.com?

It provides as-you-type lookups of reference documentation for HTML, CSS, Java, Perl and other programming languages and APIs.

AntDoclet

Posted by F 26/12/2005 at 22h19

After nearly two years of procrastination, I finally decided to spend some time on wrapping things up and putting AntDoclet online for public consumption.

AntDoclet is a little tool for documenting Ant Tasks. It automatically generates HTML and LaTeX documentation from the source code of your Tasks.

I wrote it initially in January 2004, for documenting the Ant tasks provided with the FuegoBPM product. Recently, I needed to improve it a bit, and decided to make it public.

Thanks to Fuego Inc. –my employer– who allowed me to release AntDoclet.

Version Control Systems and Open Source 2

Posted by F 11/12/2005 at 15h07

If you haven’t looked at the available Version Control Systems lately, you’d better look again.

About 5 years ago, CVS was pretty much the only open source Version Control System in use, and it’s still very popular.

But in the last few years, a surprising number of new and really good open source version control systems came to life. Like most open source projects, their authors started them to scratch a personal itch. In this case, the itch was caused by some important limitations in CVS:

  • The directory structure is not versioned (it only keeps history of files)
  • Impossibility to rename, move or copy files (without loosing history)
  • Operations (like commits) are not atomic
  • No concept of “change sets”
  • Very expensive (inefficient) branching mechanism
  • Limited merging capabilities
  • No support for decentralized repositories (distributed development).

Don’t get it wrong though: CVS is a very respectable piece of software: it’s been first released more than 20 years ago!

Among the new open source alternatives I found these to be quite popular:

  • Subversion – Explicitly designed as a replacement for CVS. I would say it’s achieving it’s goal. Many big projects moved from CVS to Subversion, like KDE, GCC, Apache.

  • SVK – Built on top Subversion’s libraries. It offers additional functionality, like distributed repositories and better merging. It integrates with existing Subversion repositories, so it’s more an extension than an alternative to Subversion.

  • Arch – Very powerful and decentralized. The current version 1 received many complains around usability, which spawned new projects like Bazaar. But version 2 promises many improvements, including ideas from Bazaar and other systems.

  • Git – Developed by Linus Torvalds and other Linux Kernel hackers when they were forced to stop using the commercial BitKeeper because of licensing issues.

  • Darcs – Written is Haskell.

  • Codeville – Apparently has an advanced merging algorithm without the problems of 3-way-merge.

  • Monotone

Subversion, like CVS, is designed around the concept of a centralized repository: all developers work against one single repository. All the other systems mentioned above are decentralized, allowing for more distributed development: several repositories may exist (say, one per developer) and they are synchronized in a peer-to-peer way.