IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
14.3.4 Option Callbacks


14.3.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



See About this document... for information on suggesting changes.