6.21.4 Option Callbacks
When optparse's built-in actions and types aren't quite enough for your
needs, you have two choices: extend optparse or define a callback option.
Extending optparse is more general, but overkill for a lot of simple
cases. Quite often a simple callback is all you need.
There are two steps to defining a callback option:
-
define the option itself using the
callback action
-
write the callback; this is a function (or method) that
takes at least four arguments, as described below
Release 2.4.2, documentation updated on 28 September 2005.
See About this document... for information on suggesting changes.
Document provided by Web Master Resources and hosted at Speedy Domain Registration Company