nicfit/command.py
def loadCommandMap(Class, subparsers=None, instantiate=True, **cmd_kwargs):
        """Instantiate each registered command to a dict mapping name/alias to
        instance.

        Due to aliases, the returned length may be greater there the number of
        commands, but the unique instance count will match.
        """
        if not Class._registered_commands:
            raise ValueError("No commands have been registered with {}"
                             .format(Class))

        all = {}
        for Cmd in set(Class._registered_commands[Class].values()):
            cmd = Cmd(subparsers=subparsers, **cmd_kwargs) \
                        if instantiate else Cmd
            for name in [Cmd.name()] + Cmd.aliases():
                all[name] = cmd
        return all
def loadCommandMap(Class, subparsers=None, instantiate=True, **cmd_kwargs):
        """Instantiate each registered command to a dict mapping name/alias to
        instance.

        Due to aliases, the returned length may be greater there the number of
        commands, but the unique instance count will match.
        """
        if not Class._registered_commands:
            raise ValueError("No commands have been registered with {}"
                             .format(Class))

        all = {}
        for Cmd in set(Class._registered_commands[Class].values()):
            cmd = Cmd(subparsers=subparsers, **cmd_kwargs) \
                        if instantiate else Cmd
            for name in [Cmd.name()] + Cmd.aliases():
                all[name] = cmd
        return all
def loadCommandMap ( Class , subparsers = None , instantiate = True , * * cmd_kwargs ) : if not Class . _registered_commands : raise ValueError ( "No commands have been registered with {}" . format ( Class ) ) all = { } for Cmd in set ( Class . _registered_commands [ Class ] . values ( ) ) : cmd = Cmd ( subparsers = subparsers , * * cmd_kwargs ) if instantiate else Cmd for name in [ Cmd . name ( ) ] + Cmd . aliases ( ) : all [ name ] = cmd return all
Instantiate each registered command to a dict mapping name/alias to
        instance.

        Due to aliases, the returned length may be greater there the number of
        commands, but the unique instance count will match.
Instantiate each registered command to a dict mapping name / alias to instance .