def _generate_command(self, func, name=None, **kwargs):
func_pointer = name or func.__name__<EOL>storm_config = get_storm_config()<EOL>aliases, additional_kwarg = None, None<EOL>if '<STR_LIT>' in storm_config:<EOL><INDENT>for command, alias_list insix.iteritems(storm_config.get("<STR_LIT>")):<EOL><INDENT>if func_pointer == command:<EOL><INDENT>aliases = alias_list<EOL>break<EOL><DEDENT><DEDENT><DEDENT>func_help = func.__doc__ and func.__doc__.strip()<EOL>subparser = self.subparsers.add_parser(name or func.__name__,<EOL>aliases=aliases,<EOL>help=func_help)<EOL>spec = inspect.getargspec(func)<EOL>opts = reversed(list(izip_longest(reversed(spec.args or []),<EOL>reversed(spec.defaults or []),<EOL>fillvalue=self._POSITIONAL())))<EOL>for k, v in opts:<EOL><INDENT>argopts = getattr(func, '<STR_LIT>', {})<EOL>args, kwargs = argopts.get(k, ([], {}))<EOL>args = list(args)<EOL>is_positional = isinstance(v, self._POSITIONAL)<EOL>options = [arg for arg in args if arg.startswith('<STR_LIT:->')]<EOL>if isinstance(v, list):<EOL><INDENT>kwargs.update({<EOL>'<STR_LIT:action>': '<STR_LIT>',<EOL>})<EOL><DEDENT>if is_positional:<EOL><INDENT>if options:<EOL><INDENT>args = options<EOL>kwargs.update({'<STR_LIT>': True, '<STR_LIT>': k})<EOL><DEDENT>else:<EOL><INDENT>args = [k]<EOL><DEDENT><DEDENT>else:<EOL><INDENT>args = options or ['<STR_LIT>' % k]<EOL>kwargs.update({'<STR_LIT:default>': v, '<STR_LIT>': k})<EOL><DEDENT>arg = subparser.add_argument(*args, **kwargs)<EOL><DEDENT>subparser.set_defaults(**{self._COMMAND_FLAG: func})<EOL>return func<EOL>
Generates a command parser for given func.

        :param func: func to generate related command parser
        :param type: function

        :param name: command name
        :param type: str

        :param **kwargs: keyword arguments those passed through to
                         :py:class:``argparse.ArgumentParser.add_parser``
        :param type: dict