OpenQuizz
Une application de gestion des contenus pédagogiques
OptionParser Class Reference
Inheritance diagram for OptionParser:
Collaboration diagram for OptionParser:

Public Member Functions

def __init__ (self, ctx=None)
 
def add_option (self, opts, dest, action=None, nargs=1, const=None, obj=None)
 
def add_argument (self, dest, nargs=1, obj=None)
 
def parse_args (self, args)
 

Data Fields

 ctx
 
 allow_interspersed_args
 
 ignore_unknown_options
 

Detailed Description

The option parser is an internal class that is ultimately used to
parse options and arguments.  It's modelled after optparse and brings
a similar but vastly simplified API.  It should generally not be used
directly as the high level Click classes wrap it for you.

It's not nearly as extensible as optparse or argparse as it does not
implement features that are implemented on a higher level (such as
types or defaults).

:param ctx: optionally the :class:`~click.Context` where this parser
            should go with.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  ctx = None 
)

Member Function Documentation

◆ add_argument()

def add_argument (   self,
  dest,
  nargs = 1,
  obj = None 
)
Adds a positional argument named `dest` to the parser.

The `obj` can be used to identify the option in the order list
that is returned from the parser.

◆ add_option()

def add_option (   self,
  opts,
  dest,
  action = None,
  nargs = 1,
  const = None,
  obj = None 
)
Adds a new option named `dest` to the parser.  The destination
is not inferred (unlike with optparse) and needs to be explicitly
provided.  Action can be any of ``store``, ``store_const``,
``append``, ``appnd_const`` or ``count``.

The `obj` can be used to identify the option in the order list
that is returned from the parser.

◆ parse_args()

def parse_args (   self,
  args 
)
Parses positional arguments and returns ``(values, args, order)``
for the parsed options and arguments as well as the leftover
arguments if there are any.  The order is a list of objects as they
appear on the command line.  If arguments appear multiple times they
will be memorized multiple times as well.

Field Documentation

◆ allow_interspersed_args

allow_interspersed_args

◆ ctx

ctx

◆ ignore_unknown_options

ignore_unknown_options

The documentation for this class was generated from the following file: