| 1 | # -*- coding: iso-8859-1 -*-
|
|---|
| 2 | """Parser for command line options.
|
|---|
| 3 |
|
|---|
| 4 | This module helps scripts to parse the command line arguments in
|
|---|
| 5 | sys.argv. It supports the same conventions as the Unix getopt()
|
|---|
| 6 | function (including the special meanings of arguments of the form `-'
|
|---|
| 7 | and `--'). Long options similar to those supported by GNU software
|
|---|
| 8 | may be used as well via an optional third argument. This module
|
|---|
| 9 | provides two functions and an exception:
|
|---|
| 10 |
|
|---|
| 11 | getopt() -- Parse command line options
|
|---|
| 12 | gnu_getopt() -- Like getopt(), but allow option and non-option arguments
|
|---|
| 13 | to be intermixed.
|
|---|
| 14 | GetoptError -- exception (class) raised with 'opt' attribute, which is the
|
|---|
| 15 | option involved with the exception.
|
|---|
| 16 | """
|
|---|
| 17 |
|
|---|
| 18 | # Long option support added by Lars Wirzenius <[email protected]>.
|
|---|
| 19 | #
|
|---|
| 20 | # Gerrit Holl <[email protected]> moved the string-based exceptions
|
|---|
| 21 | # to class-based exceptions.
|
|---|
| 22 | #
|
|---|
| 23 | # Peter Åstrand <[email protected]> added gnu_getopt().
|
|---|
| 24 | #
|
|---|
| 25 | # TODO for gnu_getopt():
|
|---|
|
|---|