command line arguments

Peter Hansen peter at engcorp.com
Thu Sep 1 08:07:29 EDT 2005


Jon Hewer wrote:
>>What's the purpose of this utility?  Is it to do something with the URL?
>>And the URL must always be specified?  What about the name?  Also
>>mandatory, or optional?  The relationship between the two?
> 
> 
> its just a simple rss reader.  i'm writing it almost purely just to
> get me using language (i'm learning python)  it lets you save rss
> feeds, and to do this one would specify a name and url (ie you have to
> specify both), but there are other things it can do (remove a rss
> feed, view a feed) hence i thought it was best to using command line
> options

In that case, consider making the URL or the name, or both, an argument 
*after* the options.  The operation you want to perform would be 
specified with an option, possibly including an argument of its own if 
that information wasn't normally needed.  For example (and keep in mind 
I really have no idea what RSS is useful for, and my sole exposure to it 
is to subscribe to the BBC Latest Headlines in Firefox):

rssutil --add -nBBC http://fxfeeds.mozilla.org/rss20.xml
rssutil --remove -n BBC
rssutil --view http://fxfeeds.mozilla.org/rss20.xml

or perhaps:
rssutil -ahttp://fxfeeds.mozilla.org/rss20.xml BBC
rssutil --remove BBC
rssutil -v BBC

I can't judge which blend of possibilities is more reasonable; I'm just 
trying to point out some of the thought process behind choosing an 
appropriate scheme.  Making *everything* an option here just feels 
wrong, from a user interface point of view.

-Peter



More information about the Python-list mailing list