Helper to lazily build the command list.
343369
function getList() {
  if(!COMMAND_LIST) {
    COMMAND_LIST = [];
    for(var z in this.execs) {
      COMMAND_LIST.push(this.execs[z].definition.getDefinition());
    }
  }
  return COMMAND_LIST;
}
452420
private static List<String> prepareBashCommand(List<String> cmd, Map<String, String> childEnv) {
    if (childEnv.isEmpty()) {
      return cmd;
    }

    List<String> newCmd = new ArrayList<>();
    newCmd.add("env");

    for (Map.Entry<String, String> e : childEnv.entrySet()) {
      newCmd.add(String.format("%s=%s", e.getKey(), e.getValue()));
    }
    newCmd.addAll(cmd);
    return newCmd;
  }
386689
def generate_help(self, filename="", command=""):
    
    "{} [{}]\n\n".format(filename, "|".join(self.available_command_list))
    help_str = """Available commands:

    """

    command_list = self.available_command_list if command == "" else [command]

    for command in command_list:
      cmd_meta = self.get_command_metainfo(command)
      """:type cmd_meta ModuleMetaInfo"""

      if cmd_meta is None:
        continue

      args = {}
      args.update(cmd_meta.get_arguments_builder().arguments)
      args.update(cmd_meta.get_arguments_builder().default_arguments)

      cmd_arguments_help = {name: value.item_help for name, value in args.items() if value.item_help}

      if len(cmd_arguments_help) > 0:
        help_str += """
        {cmd} [{args}] - {cmd_help}

        Argument details:
        {arg_details}


        """.format(
          cmd=command,
          args=" | ".join(cmd_arguments_help.keys()),
          cmd_help=cmd_meta.help,
          arg_details="\n".join(["{} - {}".format(k, v) for k, v in cmd_arguments_help.items()])
        )

      else:
        help_str += """
        {cmd} - {cmd_help}""".format(
          cmd=command,
          cmd_help=cmd_meta.help
        )

    return help_str
81634
def call_command(self, cmdname, **kw):
        """"""
        for dirname in INSTALL_DIRECTORY_ATTRS:
            kw.setdefault(dirname, self.bdist_dir)
        kw.setdefault('skip_build', self.skip_build)
        kw.setdefault('dry_run', self.dry_run)
        cmd = self.reinitialize_command(cmdname, **kw)
        self.run_command(cmdname)
        return cmd
675642
def build_from_job_list(scheme_files, templates, base_output_dir):
    """"""
    queue = Queue()
    for scheme in scheme_files:
        queue.put(scheme)

    if len(scheme_files) < 40:
        thread_num = len(scheme_files)
    else:
        thread_num = 40

    threads = []
    for _ in range(thread_num):
        thread = Thread(target=build_single_worker,
                        args=(queue, templates, base_output_dir))
        thread.start()
        threads.append(thread)

    queue.join()

    for _ in range(thread_num):
        queue.put(None)

    for thread in threads:
        thread.join()
1096475
def linkify_command_list_with_commands(self, commands, prop):
        
        for i in self:
            if not hasattr(i, prop):
                continue

            commands_list = strip_and_uniq(getattr(i, prop, ''))
            cmds_list = []
            for command in commands_list:
                if not command:
                    continue

                cmds_list.append(self.create_commandcall(i, commands, command))
            setattr(i, prop, cmds_list)
986527
def build_command(self):
        """"""
        return cron_utils.cronify("crontab -l | {{ cat; echo \"{} {} {} {} {} CJOBID='{}' MAILTO='' {}\"; }} | crontab - > /dev/null".format(self._minute, self._hour, self._day_of_month, self._month_of_year, self._day_of_week, self._jobid, self._command))
1152676
def commands(self):
        """"""
        if not getattr(self, "_commands", None):
            self._commands = []
            for command in self.orig_commands:
                if isinstance(command, Command):
                    command = [command]
                for instruction in command:
                    self._commands.append(instruction)
        return self._commands
584260
def apply_command_list_template(command_list, in_path, out_path, args):
    '''
    
    '''
    replacements = {
        '$IN': in_path,
        '$OUT': out_path,
    }

    # Add in positional arguments ($0, $1, etc)
    for i, arg in enumerate(args):
        replacements['$' + str(i)] = arg

    results = [replacements.get(arg, arg) for arg in command_list]

    # Returns list of truthy replaced arguments in command
    return [item for item in results if item]
757338
def do_commander(self):
        """"""
        # Flatten commands list then extract primary command and its arguments.
        if self._args.commands is not None:
            cmds = []
            for cmd in self._args.commands:
                cmds.append(flatten_args(split_command_line(arg) for arg in cmd))
        else:
            cmds = None

        # Enter REPL.
        PyOCDCommander(self._args, cmds).run()
580403
def cli(ctx):
    """"""
    json_path = os.path.join(os.path.expanduser('~'), '.keep', 'commands.json')
    if not os.path.exists(json_path):
        click.echo('No commands to show. Add one by `keep new`.')
    else:
        utils.list_commands(ctx)
644122
def command_help(self, *args, **kwargs):
        """"""
        print("Commands available:\n")
        for name in dir(self):
            if not name.startswith("command_"):
                continue
            name_clean = name[len("command_"):]
            print("%s:\n - %s\n" % (name_clean, getattr(self, name).__doc__.strip()))
206953
def list_commands(self, ctx):
        """"""
        env = ctx.ensure_object(environment.Environment)
        env.load()

        return sorted(env.list_commands(*self.path))
443058
def ListCommands(self):
    """"""
    print 'Available commands:'
    commands = dict(self.commands)
    for plugin in self.plugins:
      commands.update(plugin.commands)
    for com in sorted(commands):
      if not com.startswith('_'):
        self.PrintHelpTextLine(com, commands[com])
428446
def from_command_line(command_line):
    """"""
    assert is_iterable_typed(command_line, basestring)
    targets = []
    properties = []

    for e in command_line:
        if e[:1] != "-":
            # Build request spec either has "=" in it, or completely
            # consists of implicit feature values.
            if e.find("=") != -1 or looks_like_implicit_value(e.split("/")[0]):
                properties.append(e)
            elif e:
                targets.append(e)

    return [targets, properties]
713687
def cmd_list(self, argv, help):
        """"""
        parser = argparse.ArgumentParser(
            prog="%s list" % self.progname,
            description=help,
        )
        parser.add_argument("list", nargs=1,
                            metavar="listname",
                            help="Name of list to show.",
                            choices=sorted(self.list_cmds))
        parser.add_argument("listopts",
                            metavar="...",
                            nargs=argparse.REMAINDER,
                            help="list command options")
        args = parser.parse_args(argv)
        for name, func in sorted(self.list_cmds[args.list[0]]):
            func(args.listopts, func.__doc__)
667427
def _build_command_chain(self, command):
        
        next = command
        for intercepter in reversed(self._intercepters):
            next = InterceptedCommand(intercepter, next)
        self._commands_by_name[next.get_name()] = next