Make sure the alias name and alias command in the alias file is in valid format.

    Args:
        The alias file path to import aliases from.
199469
def _validate_alias_file_content(alias_file_path, url=''):
    
    alias_table = get_config_parser()
    try:
        alias_table.read(alias_file_path)
        for alias_name, alias_command in reduce_alias_table(alias_table):
            _validate_alias_name(alias_name)
            _validate_alias_command(alias_command)
            _validate_alias_command_level(alias_name, alias_command)
            _validate_pos_args_syntax(alias_name, alias_command)
    except Exception as exception:  # pylint: disable=broad-except
        error_msg = CONFIG_PARSING_ERROR % AliasManager.process_exception_message(exception)
        error_msg = error_msg.replace(alias_file_path, url or alias_file_path)
        raise CLIError(error_msg)
574714
def parse_makefile_aliases(filepath):
    '''
    
    '''

    # -- Parsing the Makefile using ConfigParser
    # Adding a fake section to make the Makefile a valid Ini file
    ini_str = '[root]\n'
    with open(filepath, 'r') as fd:
        ini_str = ini_str + fd.read().replace('@make ', '')
    ini_fp = StringIO.StringIO(ini_str)
    # Parse using ConfigParser
    config = ConfigParser.RawConfigParser()
    config.readfp(ini_fp)
    # Fetch the list of aliases
    aliases = config.options('root')

    # -- Extracting commands for each alias
    commands = {}
    for alias in aliases:
        # strip the first line return, and then split by any line return
        commands[alias] = config.get('root', alias).lstrip('\n').split('\n')

    # -- Commands substitution
    # Loop until all aliases are substituted by their commands:
    # Check each command of each alias, and if there is one command that is to
    # be substituted by an alias, try to do it right away. If this is not
    # possible because this alias itself points to other aliases , then stop
    # and put the current alias back in the queue to be processed again later.

    # Create the queue of aliases to process
    aliases_todo = commands.keys()
    # Create the dict that will hold the full commands
    commands_new = {}
    # Loop until we have processed all aliases
    while aliases_todo:
        # Pick the first alias in the queue
        alias = aliases_todo.pop(0)
        # Create a new entry in the resulting dict
        commands_new[alias] = []
        # For each command of this alias
        for cmd in commands[alias]:
            # Ignore self-referencing (alias points to itself)
            if cmd == alias:
                pass
            # Substitute full command
            elif cmd in aliases and cmd in commands_new:
                # Append all the commands referenced by the alias
                commands_new[alias].extend(commands_new[cmd])
            # Delay substituting another alias, waiting for the other alias to
            # be substituted first
            elif cmd in aliases and cmd not in commands_new:
                # Delete the current entry to avoid other aliases
                # to reference this one wrongly (as it is empty)
                del commands_new[alias]
                aliases_todo.append(alias)
                break
            # Full command (no aliases)
            else:
                commands_new[alias].append(cmd)
    commands = commands_new
    del commands_new

    # -- Prepending prefix to avoid conflicts with standard setup.py commands
    # for alias in commands.keys():
    #     commands['make_'+alias] = commands[alias]
    #     del commands[alias]

    return commands
1332587
def alias_list(self, args: argparse.Namespace) -> None:
        """"""
        if args.name:
            for cur_name in utils.remove_duplicates(args.name):
                if cur_name in self.aliases:
                    self.poutput("alias create {} {}".format(cur_name, self.aliases[cur_name]))
                else:
                    self.perror("Alias '{}' not found".format(cur_name), traceback_war=False)
        else:
            sorted_aliases = utils.alphabetical_sort(self.aliases)
            for cur_alias in sorted_aliases:
                self.poutput("alias create {} {}".format(cur_alias, self.aliases[cur_alias]))
1255198
def run_alias():
    
    mode = Path(sys.argv[0]).stem
    help = True if len(sys.argv) <= 1 else False
    if mode == 'lcc':
        sys.argv.insert(1, 'c')
    elif mode == 'lpython':
        sys.argv.insert(1, 'python')
    sys.argv.insert(1, 'run')
    if help:
        sys.argv.append('--help')
    main.main(prog_name='backend.ai')
1029733
def resolve_aliases(self, chunks):
        '''
        
        '''
        for idx, _ in enumerate(chunks):
            new_state = self.aliases.get(chunks[idx]['state'])
            if new_state is not None:
                chunks[idx]['state'] = new_state
664843
def resolve_alias(self, path_str):
        """"""
        if path_str in self.aliases:
            return self.aliases[path_str]
        return path_str
789230
def create_alias(self, alias_name):
        """"""

        return self._es_conn.indices.put_alias(index=self._es_index, name=alias_name)
753251
def create_alias(alias_name, alias_command):
    
    alias_name, alias_command = alias_name.strip(), alias_command.strip()
    alias_table = get_alias_table()
    if alias_name not in alias_table.sections():
        alias_table.add_section(alias_name)

    alias_table.set(alias_name, 'command', alias_command)
    _commit_change(alias_table)
1014055
function runAlias(aliasName, directories, options, argv) {
	return new Promise((resolve, reject) => {
		const tasks = getAllAliases(options)[aliasName];
		if (!tasks) {
			reject(new MrmUnknownAlias(`Alias “${aliasName}” not found.`));
			return;
		}

		console.log(kleur.yellow(`Running alias ${aliasName}...`));

		promiseSeries(tasks, name => {
			return runTask(name, directories, options, argv);
		})
			.then(() => resolve())
			.catch(reject);
	});
}
178569
def __write_aliases_file(lines):
    '''
    
    '''
    afn = __get_aliases_filename()
    adir = os.path.dirname(afn)

    out = tempfile.NamedTemporaryFile(dir=adir, delete=False)

    if not __opts__.get('integration.test', False):
        if os.path.isfile(afn):
            afn_st = os.stat(afn)
            os.chmod(out.name, stat.S_IMODE(afn_st.st_mode))
            os.chown(out.name, afn_st.st_uid, afn_st.st_gid)
        else:
            os.chmod(out.name, 0o644)
            os.chown(out.name, 0, 0)

    for (line_alias, line_target, line_comment) in lines:
        if isinstance(line_target, list):
            line_target = ', '.join(line_target)
        if not line_comment:
            line_comment = ''
        if line_alias and line_target:
            write_line = '{0}: {1}{2}\n'.format(
                line_alias, line_target, line_comment
            )
        else:
            write_line = '{0}\n'.format(line_comment)
        if six.PY3:
            write_line = write_line.encode(__salt_system_encoding__)
        out.write(write_line)

    out.close()
    os.rename(out.name, afn)

    # Search $PATH for the newalises command
    newaliases = salt.utils.path.which('newaliases')
    if newaliases is not None:
        __salt__['cmd.run'](newaliases)

    return True
134645
def delete_alias(self, using=None, **kwargs):
        
        return self._get_connection(using).indices.delete_alias(index=self._name, **kwargs)
962262
def make_alias(self, entry):
        
        entry.add_alias(self)
        self.alias = entry
        self.scope = entry.scope  # Local aliases can be "global" (static)
        self.byref = entry.byref
        self.offset = entry.offset
        self.addr = entry.addr
789754
def _validate_cert_path(name):
    '''
    
    '''
    cmd = r"Test-Path -Path '{0}'".format(name)

    if not ast.literal_eval(_cmd_run(cmd=cmd)):
        raise SaltInvocationError(r"Invalid path specified: {0}".format(name))
280793
def get_alias_dict(config_obj):
    
    if not config_obj.examples_dir:
        return {}

    alias_file_path = _get_alias_file_path(config_obj)
    if not os.path.isfile(alias_file_path):
        return {}

    alias_file_contents = _get_contents_of_file(alias_file_path)
    result = json.loads(alias_file_contents)
    return result
267519
def process_alias_create_namespace(namespace):
    
    namespace = filter_alias_create_namespace(namespace)
    _validate_alias_name(namespace.alias_name)
    _validate_alias_command(namespace.alias_command)
    _validate_alias_command_level(namespace.alias_name, namespace.alias_command)
    _validate_pos_args_syntax(namespace.alias_name, namespace.alias_command)
1250315
def add_func(self, callback, names, *args):
        

        if isinstance(names, list):
            for name in names:
                self.add_func(callback, name, *args)
                self.aliases[name] = names
        elif isinstance(names, str):
            if names in self.cmds or names in self.clis:
                raise ValueError('Attempting to overwrite cmd or extern CLI: %s' % names)
            parser = argparse.ArgumentParser(prog=names)
            for cmd, spec in args:
                parser.add_argument(cmd, **spec)
            self.cmds[names] = (callback, parser)
        else:
            raise TypeError("Command must be specified by str name or list of names")
1356671
def run_active_command
      require_valid_command
      if alias? command_name_from_args
        active_command.run(*(@aliases[command_name_from_args.to_s] + args_without_command_name))
      else
        active_command.run(*args_without_command_name)
      end
    end