o |¿nh- ã@srdZddlmZddlmZmZddlmZddlm Z ddl m Z e e ƒZ Gdd „d eƒZGd d „d ee ƒZd S) z Cement core argument module. é)Úabstractmethod)ÚAnyÚListé)Ú Interface)ÚHandler)Úminimal_loggerc@sVeZdZdZGdd„dejƒZedededdfdd „ƒZ ede ede fd d „ƒZ dS) ÚArgumentInterfacea This class defines the Argument Interface. Handlers that implement this interface must provide the methods and attributes defined below. In general, most implementations should sub-class from the provided :class:`ArgumentHandler` base class as a starting point. c@seZdZdZdZdS)zArgumentInterface.MetazInterface meta-data options.ÚargumentN)Ú__name__Ú __module__Ú __qualname__Ú__doc__Ú interface©rrúG/usr/local/bin/dhwp/env/lib/python3.10/site-packages/cement/core/arg.pyÚMetasrÚargsÚkwÚreturnNcOódS)a´Add arguments to the parser. This should be ``-o/--option`` or positional. Note that the interface defines the following parameters so that at the very least, external extensions can guarantee that they can properly add command line arguments when necessary. The implementation itself should, and will provide and support many more options than those listed here. That said, the implementation must support the following: Args: args (list): List of option arguments. Generally something like ``['-h', '--help']``. Keyword Args: dest (str): The destination name (variable). Default: `args[0]` help (str): The help text for ``--help`` output (for that argument). action (str): Must support: ``['store', 'store_true', 'store_false', 'store_const']`` choices (list): A list of valid values that can be passed to an option whose action is ``store``. const (str): The value stored if ``action == 'store_const'``. default (str): The default value. Returns: None Nr)ÚselfrrrrrÚ add_argumentszArgumentInterface.add_argumentcGr)aý Parse the argument list (i.e. ``sys.argv``). Can return any object as long as its' members contain those of the added arguments. For example, if adding a ``-v/--version`` option that stores to the dest of ``version``, then the member must be callable as ``Object().version``. Args: args (list): A list of command line arguments Returns: object: A callable object whose members reprisent the available arguments Nr)rrrrrÚparse?szArgumentInterface.parse) r r r rrrrÚstrrrrÚobjectrrrrrr sr c@s"eZdZdZGdd„dejƒZdS)ÚArgumentHandlerzArgument handler implementationc@s eZdZdS)zArgumentHandler.MetaN)r r r rrrrrVsrN)r r r rrrrrrrrRsrN)rÚabcrÚtypingrrÚcore.interfacerÚ core.handlerrÚ utils.miscrr ÚLOGr rrrrrÚs    C