Re: optparse options

2009-05-20 Thread Mike Kazantsev
Ben Finney wrote: > icarus 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, arg

Re: optparse options

2009-05-19 Thread Ben Finney
icarus 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: 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... $ python

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

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)

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-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 execu

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; s