[getopt-sig] ObjectCLI

Shane Hathaway shane@zope.com
Wed, 20 Feb 2002 10:31:07 -0500


Greg Ward wrote:
> [Shane]
> 
>>I'm pretty sure you and I have different goals.  I think your main goal is
>>to create a featureful option parser that does a better job than getopt.
>>My main goal is to eliminate the work of parsing options altogether,
>>possibly sacrificing some flexibility.  The differing goals result in very
>>different mindsets.  I'd like to know what other people's goals are.
> 
> Right, I want to be able to implement the normal, sensible, conventional
> GNU/Unix command-line syntax in every script I write with minimal fuss
> and bother.  I want this mechanism to be flexible, extensible, and in
> the standard library.  I don't think a solution that sacrifices
> flexibility belongs in the standard library; things like having short
> and long options that mean the same thing are just too important.
> Strong typing and automatically generated help for each option are also
> really nice.

Ok, we understand each other.  I think the difference boils down to the 
projects we're working on.  You're making utilities.  Utilities must 
have a very clean and often customized command-line interface.  "ls", 
"sort", "tar", etc. fall into this category.

I'm making applications.  Applications usually have a lot of features 
and making all the functions accessible via options is not a good UI. 
So applications often have subcommands, but the CLI is still an 
afterthought.  Most of the KDE apps (and probably GNOME apps as well) 
are examples of commands with a CLI as an afterthought.  "cvs" is an 
application with a reasonable UI.  "rpm" is also an application, though 
its option signature is peculiar.

I think there are a lot of Python applications that would benefit from a 
very easy way to provide a CLI.

> More fundamentally, I think it's unrealistic to think that you can
> eliminate the work of parsing options altogether.  Smells like wishful
> thinking.  Anyways, I have convinced myself -- by writing Optik -- that
> it's possible to make the work of option parsing very easy and
> unobtrusive.  

Yes, I agree it's wishful thinking to believe you can eliminate option 
parsing for general-purpose utilities.  But I think it is very 
reasonable for applications.

Shane