getopt or optparse options/arguments wrapping?

Steven Bethard steven.bethard at gmail.com
Fri Mar 16 18:15:39 CET 2007


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 && find to complete full and
> differentiating/incremental backup for the file system level files,
> and their restoring. This script will do different things by the
> command line arguments, and execute find/tar in different ways, but
> for being more flexible, I want some options of tar/find can also been
> specified from the command line directly, and the script just transmit
> those to tar/find simply.

I'm not clear on exactly what it is you want.  Are you trying to do
something like::

    fs_backup --foo --bar x y z --tar-foo --tar-bar tx ty tz

where ``--foo --bar x y z`` gets handled by your command and ``--tar-foo
--tar-bar tx ty tz`` gets passed on through to the tar command?

STeVe



More information about the Python-list mailing list