Add the parameter to ``Parameters``.

        **Arguments**

        The arguments are lumped into two groups:``Parameters.add_parameter``
        and ``argparse.ArgumentParser.add_argument``.  Parameters that are only
        used by ``Parameters.add_parameter`` are removed before ``kwargs`` is
        passed directly to argparse.ArgumentParser.add_argument``.

        .. note::
            Once ``parse`` has been called ``Parameters.parsed`` will be True
            and it is inadvisable to add more parameters to the ``Parameters``.

        *``Parameters.add_parameter`` Arguments*

        :``environment_prefix``: Prefix to add when searching the environment
                                 for this parameter.  Default:
                                 os.path.basename(sys.argv[0]).
        :``group``:              Group (namespace or prefix) for parameter
                                 (corresponds to section name in configuration
                                 files).  Default: 'default'.
        :``options``:            REQUIRED.  The list of options to match for
                                 this parameter in argv.
        :``only``:               Iterable containing the components that this
                                 parameter applies to (i.e. 'environment',
                                 'configuration', 'argument').  Default:
                                 ('environment', 'configuration', 'argument').

        *``argparse.ArgumentParser.add_argument`` Arguments*

        :``name or flags``: Positional argument filled in by options keyword
                            argument.
        :``action``:        The basic type of action to be taken when this
                            argument is encountered at the command line.
        :``nargs``:         The number of command-line arguments that should be
                            consumed.
        :``const``:         A constant value required by some action and nargs
                            selections.
        :``default``:       The value produced if the argument is absent from
                            the command line.
        :``type``:          The type to which the command-line argument should
                            be converted.
        :``choices``:       A container of the allowable values for the
                            argument.
        :``required``:      Whether or not the command-line option may be
                            omitted (optionals only).
        :``help``:          A brief description of what the argument does.
        :``metavar``:       A name for the argument in usage messages.
        :``dest``:          The name of the attribute to be added to the object
                            returned by parse_args().

def add_parameter(self, **kwargs):
        '''Add the parameter to ``Parameters``.

        **Arguments**

        The arguments are lumped into two groups:``Parameters.add_parameter``
        and ``argparse.ArgumentParser.add_argument``.  Parameters that are only
        used by ``Parameters.add_parameter`` are removed before ``kwargs`` is
        passed directly to argparse.ArgumentParser.add_argument``.

        .. note::
            Once ``parse`` has been called ``Parameters.parsed`` will be True
            and it is inadvisable to add more parameters to the ``Parameters``.

        *``Parameters.add_parameter`` Arguments*

        :``environment_prefix``: Prefix to add when searching the environment
                                 for this parameter.  Default:
                                 os.path.basename(sys.argv[0]).
        :``group``:              Group (namespace or prefix) for parameter
                                 (corresponds to section name in configuration
                                 files).  Default: 'default'.
        :``options``:            REQUIRED.  The list of options to match for
                                 this parameter in argv.
        :``only``:               Iterable containing the components that this
                                 parameter applies to (i.e. 'environment',
                                 'configuration', 'argument').  Default:
                                 ('environment', 'configuration', 'argument').

        *``argparse.ArgumentParser.add_argument`` Arguments*

        :``name or flags``: Positional argument filled in by options keyword
                            argument.
        :``action``:        The basic type of action to be taken when this
                            argument is encountered at the command line.
        :``nargs``:         The number of command-line arguments that should be
                            consumed.
        :``const``:         A constant value required by some action and nargs
                            selections.
        :``default``:       The value produced if the argument is absent from
                            the command line.
        :``type``:          The type to which the command-line argument should
                            be converted.
        :``choices``:       A container of the allowable values for the
                            argument.
        :``required``:      Whether or not the command-line option may be
                            omitted (optionals only).
        :``help``:          A brief description of what the argument does.
        :``metavar``:       A name for the argument in usage messages.
        :``dest``:          The name of the attribute to be added to the object
                            returned by parse_args().

        '''

        parameter_name = max(kwargs['options'], key = len).lstrip('-')

        if 'dest' in kwargs:
            parameter_name = kwargs['dest']

        group = kwargs.pop('group', 'default')
        self.groups.add(group)

        parameter_name = '.'.join([ group, parameter_name ]).lstrip('.').replace('-', '_')

        logger.info('adding parameter %s', parameter_name)

        if self.parsed:
            logger.warn('adding parameter %s after parse', parameter_name)
            warnings.warn('adding parameter {} after parse'.format(parameter_name), RuntimeWarning)

        self.parameters[parameter_name] = copy.copy(kwargs)
        self.parameters[parameter_name]['group'] = group
        self.parameters[parameter_name]['type'] = kwargs.get('type', str)
        self.parameters[parameter_name]['environment_prefix'] = kwargs.pop('environment_prefix', os.path.basename(sys.argv[0]))

        if self.parameters[parameter_name]['environment_prefix'] is not None:
            self.parameters[parameter_name]['environment_prefix'] = self.parameters[parameter_name]['environment_prefix'].upper().replace('-', '_')

        logger.info('group: %s', group)

        self.grouped_parameters.setdefault(group, {}).setdefault(parameter_name.replace(group + '.', ''), self.parameters[parameter_name])

        action_defaults = {
            'store': kwargs.get('default'),
            'store_const': kwargs.get('const'),
            'store_true': False,
            'store_false': True,
            'append': [],
            'append_const': [],
            'count': 0,
        }

        self.defaults[parameter_name] = action_defaults[kwargs.get('action', 'store')]

        logger.info('default value: %s', kwargs.get('default'))

        if 'argument' in kwargs.pop('only', [ 'argument' ]):
            if group not in self._group_parsers:
                self._group_parsers[group] = self._group_parsers['default'].add_argument_group(group)

            if self._group_prefix and group != 'default':
                long_option = max(kwargs['options'], key = len)

                kwargs['options'].remove(long_option)
                kwargs['options'].append(long_option.replace('--', '--' + group.replace('_', '-') + '-'))

                logger.debug('options: %s', kwargs['options'])

            self._group_parsers[group].add_argument(*kwargs.pop('options'), **kwargs)