ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> python-list
python-list
Re: Arg decoding with a template?
by Jim Dennis other posts by this author
Aug 6 2001 1:08AM messages near this date
Re: Arg decoding with a template? | Re: Arg decoding with a template?
In article <rdeemts4mrarb8b5ghqieio68n1jv32tl1@[...].com> , 
  Dale Strickland-Clark wrote:

> David Bolen <db3l@[...].com> wrote:

> >-- David

>  I guess what I had in mind was a simple but effective equivelent that
>  I used to use with BCPL. A function called rdargs, which I think also
>  became part of AmigaDOS

 For those of us who are unfamiliar with these; do you care to 
 show an example of the syntax and explain why you think it's superior?

>  I've just had a quick hunt with Google and I can't find a definition
>  for it anywhere.

>  I'll probably end up using getopt just because I don't have time to 
>  do a proper job right now.

 It might be possible to create a subclass of getopt which 
 provides a similar API (list of methods) but accepts your 
 preferred syntax.

 BTW: It would be *REALLY* nice if you'd wrap you lines at <72 chars
 and provide a leading space (margin) to your posts.  80 character
 widths are still a dominant convention for USENET/netnews and 
 public mailing lists, and leaving a few characters for quoting
 prefixes is always appreciated. 
 
 Someone in this thread mentioned the convenience of '?-completion'
 on *switches* as well as filenames.  Of course in the latest versions
 of the popular UNIX/Linux shells there is support for "programmable 
 completion."  However, it would be difficult to make that work with
 arbitrary command arguments.  I suppose one could emulate it with 
 a couple of features:

 	For each (known) command: 
		Build a list of known switches

	Compile that into a database/dbm hash

	On (tab completion):
		if known:
			match command (arg[0]) and
			match/glob switch "head" on known switches
			present a list of completions
		else:
			call command with --help:
			grep for - lines that match current switch "head"

 ... That would be cool. 
		
-- 
http://mail.python.org/mailman/listinfo/python-list
Thread:
Dale Strickland-Clark
David Bolen
Jim Dennis
Marcin 'Qrczak' Kowalczyk
Chui Tey
David Bolen
Hans-Joachim Widmaier
Hans-Joachim Widmaier
Skip Montanaro
Quinn Dunkan
Dale Strickland-Clark
David Bolen
Steve Holden
David Bolen
Alex Martelli
Dale Strickland-Clark
Dale Strickland-Clark
Skip Montanaro
David Bolen
Peter Wang
Steve Holden
David Bolen
Steve Holden
Skip Montanaro

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved