Re: optparse options

2009-05-20 Thread Mike Kazantsev
Ben Finney wrote: icarus rsa...@gmail.com writes: parser = optparse.OptionParser(usage=%prog [-p dir] [--part=dir] , version=%prog 1.0) parser.add_option( -p, --part, dest=directory, help=process target directory, metavar=dir) (options, args) =

optparse options

2009-05-19 Thread icarus
Why do I need to put two options for this script to print the path? if I just specify the option and argument... $ python script.py -p Usage: script.py [-p dir] [--part=dir] script.py: error: No options specified So I need to give it two arguments... $ python script.py --part y

Re: optparse options

2009-05-19 Thread Robert Kern
On 2009-05-19 16:07, icarus wrote: Why do I need to put two options for this script to print the path? if I just specify the option and argument... $ pythonscript.py -p Usage:script.py [-p dir] [--part=dir] script.py: error: No options specified So I need to give it two arguments... $

Re: optparse options

2009-05-19 Thread Ben Finney
icarus rsa...@gmail.com writes: parser = optparse.OptionParser(usage=%prog [-p dir] [--part=dir] , version=%prog 1.0) parser.add_option( -p, --part, dest=directory, help=process target directory, metavar=dir) (options, args) = parser.parse_args()

Re: getopt or optparse options/arguments wrapping?

2007-03-18 Thread Rocky Zhou
Well, I think I must have more explanation on my script. The script's usage is like this: ~# fs_backup Lack of backup identity name program usage: fs_backup [OPTIONS] $identity OPTIONS: -a|--append [t/x[L]:$path, append 1 dir or file to $identity t/x: include/exclude list, as -T/-X

Re: getopt or optparse options/arguments wrapping?

2007-03-18 Thread Steven Bethard
Rocky Zhou wrote: .dirs .files is just a snapshot of the current directories, which can be used to delete-outdated files when restoring. Here I used absolute path by using tar's -P parameter. When fs_rstore, it will do this: command = tar -xpz -P -f %s.tgz -T %s % (archive, self.t_files)

getopt or optparse options/arguments wrapping?

2007-03-16 Thread Rocky Zhou
I wonder is there any way to make the wrapper program can wrap options arguments for the the subprocess/command the wrapper will execute? by getopt or optparse module? This is something like the shell script like this: optwrap= while [ $# -gt 0 ]; do case $1 in -a) do-something;

Re: getopt or optparse options/arguments wrapping?

2007-03-16 Thread Steven Bethard
Rocky Zhou wrote: I wonder is there any way to make the wrapper program can wrap options arguments for the the subprocess/command the wrapper will execute? by getopt or optparse module? [snip] I need this because I now have finished a fs_backup script written in python, it will execute tar

[ python-Feature Requests-1073198 ] Extension to optparse: options with optional arguments

2007-03-15 Thread SourceForge.net
of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: None Status: Closed Resolution: Invalid Priority: 5 Private: No Submitted By: pollastri (pollastri) Assigned to: Greg Ward (gward) Summary: Extension to optparse

[ python-Feature Requests-1073198 ] Extension to optparse: options with optional arguments

2005-03-19 Thread SourceForge.net
: None Priority: 5 Submitted By: pollastri (pollastri) Assigned to: Greg Ward (gward) Summary: Extension to optparse: options with optional arguments Initial Comment: When parsing command line options, I found very useful to have an option with a facultative value, able to do the following: 1-tell