14.3.4.4 Callback example 1: trivial callback
Here's an example of a callback option that takes no arguments, and
simply records that the option was seen:
def record_foo_seen(option, opt_str, value, parser):
parser.saw_foo = True
parser.add_option("--foo", action="callback", callback=record_foo_seen)
Of course, you could do that with the store_true action.
Release 2.5.2, documentation updated on 21st February, 2008.
See About this document... for information on suggesting changes.
|