Add alternative names to you custom commands.

    `names` is a single string with a space separated list of aliases for the
    decorated command.
6397
def alt_names(names: str) -> Callable[..., Any]:
    
    names_split = names.split()

    def decorator(func: Callable[..., Any]) -> Callable[..., Any]:
        func.alt_names = names_split  # type: ignore
        return func
    return decorator
307832
function commandAlias(context, name) {
    let value;
    context.alias = context.alias || {};

    value = context.last;

    name = context.valueOf(name, true);
    value = context.valueOf(value, true);

    if (context.debug) {
        log.debug('cmd alias ' + stringify(name) + ' ' + stringify(value));
    }
    context.alias[name] = value;

    return (context.last = [VALUE, value]);
}
595250
def add_command(self, factory, main, name=None, context_kwargs=None):
        
        if name is None:
            name = factory.__name__.replace('_', '-')

        if context_kwargs is None:
            context_kwargs = {}

        short_desc, long_desc = parse_docstring(factory.__doc__)
        if long_desc:
            long_desc = short_desc + '\n\n' + long_desc

        # determine the absolute import string if relative
        if isinstance(main, str) and (
            main.startswith('.') or main.startswith(':')
        ):
            module = __import__(factory.__module__, None, None, ['__doc__'])
            package = package_for_module(module)
            if main in ['.', ':']:
                main = package.__name__
            else:
                main = package.__name__ + main

        self.commands[name] = CommandMeta(
            factory=factory,
            main=main,
            name=name,
            help=short_desc,
            description=long_desc,
            context_kwargs=context_kwargs,
        )
1270949
def set_command_namespaces
      lib_commands = @commands.inject({}) {|t,e| (t[e.lib] ||= []) << e; t }
      namespace_libs = @libraries.select {|e| e.namespace(e.indexed_namespace) }
      namespace_libs.each {|lib|
        (lib_commands[lib.name] || []).each {|e| e.namespace = lib.namespace }
      }
    end
1176268
def add_commands(self):
        
        self.parser.add_argument(
            '-d',
            action="count",
            **self.config.default.debug.get_arg_parse_arguments())
114537
def add_command(self, cmd, name=None):
        
        name = name or cmd.name
        if name is None:
            raise TypeError('Command has no name.')
        self.commands[name] = cmd
971460
def command(name, mode):
    
    def decorator(fn):
        commands[name] = fn.__name__
        _Client._addMethod(fn.__name__, name, mode)
        return fn
    return decorator
314371
def add_cmd(self, name, help=None, func=None):
        
        if self.subparsers is None:
            self.subparsers = self.add_subparsers(
                title="sub-commands",
                help=help or 'sub-commands',
            )

        parser = self.subparsers.add_parser(
            name,
            help=help,
        )
        if func is not None:
            parser.set_defaults(_func=func)
        return parser
289266
def add_subcommands(parser, commands):
    ""
    subps = parser.add_subparsers()
    for cmd, cls in commands:
        subp = subps.add_parser(cmd, help=cls.__doc__)
        add_args = getattr(cls, 'add_arguments', None)
        if add_args:
            add_args(subp)
        handler = getattr(cls, 'handle', None)
        if handler:
            subp.set_defaults(handler=handler)
1156827
def redefine_commands(lib, commands)
      option_commands = lib.command_objects(commands).select(&:option_command?)
      accepted, rejected = option_commands.partition {|e|
        e.args(lib) || e.arg_size }
      if verbose && rejected.size > 0
        puts "Following commands cannot have options until their arguments " +
          "are configured: " + rejected.map {|e| e.name}.join(', ')
      end
      accepted.each {|cmd| Scientist.redefine_command(lib.namespace_object, cmd) }
    end
1028005
function (parsedName) {
      parsedName.name = parsedName.name.replace(/\./g, '_');
      if (parsedName.name === 'basic') {
        parsedName.name = '';
      }
    }
443626
def names(self, with_namespace=False):
        '''
        '''
        N = self.count()
        names = self.name.split(settings.splittingnames)[:N]
        n = 0
        while len(names) < N:
            n += 1
            names.append('unnamed%s' % n)
        if with_namespace and self.namespace:
            n = self.namespace
            s = settings.field_separator
            return [n + s + f for f in names]
        else:
            return names
1264536
def name(cls):
        """"""
        name = cls.__name__.replace("_", "-").lower()
        name = name[4:] if name.startswith("cmd-") else name
        return name
246428
def _normalize_custom_param_name(name):
    

    replacements = (("\u2018", "'"), ("\u2019", "'"), ("\u201C", '"'), ("\u201D", '"'))
    for orig, replacement in replacements:
        name = name.replace(orig, replacement)
    return name
158704
def add_command_meta(name, command, is_alias=false) #:nodoc:
      syntax = command[:syntax]

      @commands[:meta][name] = {
        :syntax      => syntax.is_a?(Array) ? syntax : [syntax],
        :description => command[:description],
        :is_public   => command[:is_public] || false,
        :is_alias    => is_alias
      }
    end
1328916
def _makeUniqueFilename(taken_names, name):
    
    if name in taken_names:
        # try to form up new name
        basename, ext = os.path.splitext(name)
        num = 1
        name = "%s-%d%s" % (basename, num, ext)
        while name in taken_names:
            num += 1
            name = "%s-%d%s" % (basename, num, ext)
    # finally, enter name into set
    taken_names.add(name)
    return name
820788
def subcommand(self, name, help):
    
    if self._subcommands is None:
      self._subcommands = self.add_subparsers(help='commands')
    return self._subcommands.add_parser(name, description=help, help=help)