473,385 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

optparse functionality missing


Hi,

optparse doesn't seem to have a pass-through capability for command line
parameters/options that were not registered with add_option.

I'm not the first person to complain about this. On Wed Mar 17 08:20:10 CET
2004, there's a thread titled "Perceived optparse shortcomings" where someone
complains of the same problem.

In a scripting environment, I often want to strip some of the command line
options off the argument list, and then pass the remaining options to another
module that is deeper in the tool chain.

optparse doesn't seem to allow this, as far as I can tell. It requires that
you register all possible options with add_option() or an error is flagged.
When my second tier module is an autoconf script that could have hundreds of
its own options, it seems dumb to have to register all those options, just to
have to reconvert them to command-line options so that I can pass them to the
autoconf command line.

Could we get a mode added to optparse so that any commandline
parameters/options that are not registered via add_option() can be in the args
return value of the parse_args() method?

-Jeff
Jun 27 '08 #1
1 1155
Jeff Keasler <ke*****@llnl.govwrote:
In a scripting environment, I often want to strip some of the command
line options off the argument list, and then pass the remaining
options to another module that is deeper in the tool chain.
The difficulty is that you can't do an accurate parse without knowing
which options take arguments. For example, what are the options here?

foo -xyzzy -abcdef -ghi -ghi -g -hi

Well, `-z', `-f' and `-g' take arguments; the `-g' argument is
optional. So the correct options to pass along are

-x -y -zzy -a -b -c -d -e -f-ghi -ghi -g -h -i

Not so obvious, is it? ;-)

-- [mdw]
Jun 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Andres Corrada-Emmanuel | last post by:
Hi, I'm getting a conflict between options defined between two different scripts and I'm wondering if it is a bug or the intended effect. script foo: <def some_function> <define some...
8
by: Hans-Joachim Widmaier | last post by:
I was really pleased when the Optik module found its way into the standard Python battery compartment, as it matched all my option parsing requirements. But, as always, there's really nothing that...
0
by: Skip Montanaro | last post by:
I'm trying to convert my brain from getopt to optparse. I want to refer to documentation similar to the regular library reference manual docs which concisely documents the Option and OptionParser...
3
by: washu | last post by:
Hi, I'm was going through the module help located on http://docs.python.org/lib/optparse-store-action.html and I tried modifying it a tiny bit and things don't work. If someone could tell me...
7
by: Henry Ludemann | last post by:
I've been writing an optparse alternative (using getopt) that is at a stage where I'd be interested in people's opinions. It allows you to easily creating command line interfaces to existing...
3
by: Bob | last post by:
I'd like to setup command line switches that are dependent on other switches, similar to what rpm does listed below. From the grammar below we see that the "query-options" are dependent on the...
5
by: john.m.roach | last post by:
I'm trying to implement some simple command line options. Some of the 'help' sections are long and I would like to control line breaks. How do you do this? Thanks!
0
by: Robert Kern | last post by:
Jeff Keasler wrote: If you code it up with unit tests and documentation, it has a good chance. But in the meantime, you can tell optparse to stop processing options using the standard "--"...
7
by: wannymahoots | last post by:
optparse seems to be escaping control characters that I pass as arguments on the command line. Is this a bug? Am I missing something? Can this be prevented, or worked around? This behaviour...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.