Falling (back) in love with the command line

Its all Mike Mason‘s fault. He sent me an email a few months ago asking me to review his new Subversion Book. Little did I know it was actually a ploy to turn his former bash-savvy, now cheese-eating Windows GUI dependent, sparring partner back to the realm of the $ and # ….

So on a slightly more serious note… Mike’s book, like the rest in the Pragmatic Starter Kit, uses the ‘command line’ version of tools to explain concepts and usage. I was a bit worried about this at first. I’ve become used to my Tortoise SVN, my P4Win and my Eclipse CVS plugin, why did we need to go ‘back to basics’? Anyway, Mike’s a mate so I carried on through to chapters 2, 3 and onward.

I don’t know what happened in those hours of reading but when next I went to access a Subversion server the following week, I found TortoiseSVN clunky to use. Now, don’t get me wrong, Tortoise SVN is a great SVN UI client, but therin lies the problem – its a UI client. I’d got used to the speed of doing a ‘svn stat’ (tell me what’s changed), or an ‘svn stat -u’ (tell me what’s changed, including any updates to the server). In Tortoise I have to navigate explorer to the right folder, right click a folder and then select .. umm, what is it again?

I always used to use command prompt tools but in recent years I’ve got lazy, and its not a good type of lazy. Its the lazy of living with a broken window, of learning ‘just enough to solve the current problem and no more’. The command line takes that little bit more effort to get right initially, but what I’d forgotten was that with a decent command line application you are repaid your efforts later. Combine that with a little scripting knowledge and you can start plugging tools together and really start becoming truely lazy, the good lazy of being able to sit back and drink your coffee while a computer does all the repetitive work that you would normally do repeatedly yourself.

So am I forced to become another member of the Mac-owning Masses to re-embark on my journey to shell nirvana? Not at all. With Cygwin I have a fully featured BASH shell on my Windows machine (and the Windows command prompt (cmd.exe) isn’t all that bad for getting started). VBscripters or Javascripters can also use Windows ‘cscript’ scripting host. For build scripts, NAnt allows you to interpret C# or VB.NET at run time through the <script> task. Finally .NET applications have full abilities to launch processes and access the standard streams.

And have I actually done anything beyond using command-line svn? Yep, you’re reading it. I used to upload my blog content using WinSCP, but now I use rsync, running on Cygwin, to upload the differences in my locally-generated blog pages to a UNIX server. It requires about 10% the of the hand movement on my part and completes in about 10% of the time. My next plan is to put a command line wrapper on to my blog application, wrap the whole process up in a script and run it from a CruiseControl.NET project, running under Mono, monitoring the Subversion server where my blog source content is hosted. Then updating my blog will be as easy as adding a new file to a Subversion repository (and with Mozilla Composer + mod_svn, that’s a trivial task.)

Oh, and maybe I’ll buy a Mac Mini anyway. 🙂

Advertisements