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) =
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
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...
$
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()
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
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)
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;
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
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
: 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
10 matches
Mail list logo