Thursday, September 20, 2012

Why is command line cool!? :)

As a developer, I love command-line!, instead of a few clicks here and there on a GUI, I would rather pipe, filter, combine and make new shortcuts to do things quickly and efficiently.
libcli generated CLI sample
While in college, once I got used to the Unix shells, doing anything on Windows shell was a pain!, mainly because of the lack of auto-completion! It was even more painful, when I started using Java on windows (without any funky IDEs). First of all, I hate CamelCase, and since that is default in Java, running
and then
java SomeLongFile...
over and over, in the edit-compile cycle, made me create my first shell! :). I called it ACSH (Auto Command Completion Shell) :), all it did was to find the file names in current directory (DIRENT..), and then do the completion based on the first few characters, finally, on Enter, use system() :). Simple, but worked well, some of my friends also used it.

At that point, I didn't know about command modes, or, structuring the commands in a tree like hierarchy. Only after encountering the IOS (note the case - not iOS!) parser did I get more ideas on command line. But then I had lost my ACSH source (since Yahoo Geocities closed down, and I didn't take a backup! :-(, I might still have it somewhere on old Floppies or disks, I don't have time to find it!), while discussing the IOS command line capability with a friend, I created a bare-bones implementation using a Trie, worked well  long time after, when I started working on a module, which had a simulator and dumb CLI, I could not bear to use it! I enhanced my Trie based CLI to create a library, with some capabilities of IOS parser and a few bash like features, and plugged it in. I continue to maintain it, and keep adding new features, whenever I get some idea about how-to-make-command-line-more-usable :)

Many people think command line is dead!, and funky GUIs are the way to go! that isn't true!, just think - why did MS create the PowerShell in 2006 !?

CLI is cool because it get things done, quick! and it can be re-combined, re-configured, aliased, with use, you can be faster ...

No comments: