command line as list
976978
def command_list_arscons(self):
        ''''''
        cmd = []
        cmd += ['scons']

        if self.arduino_home:
            cmd += ['ARDUINO_HOME=' + self.arduino_home]
#        if os.environ.get('ARDUINO_HOME', None):
#            cmd += ['ARDUINO_HOME=' + os.environ.get('ARDUINO_HOME')]

        if self.avr_home:
            cmd += ['AVR_HOME=' + self.avr_home]

        if self.board:
            cmd += ['ARDUINO_BOARD=' + self.board]

        if self.hwpack:
            cmd += ['ARDUINO_HARDWARE_PACKAGE=' + self.hwpack]

        if self.mcu:
            cmd += ['MCU=' + self.mcu]
        if self.f_cpu:
            cmd += ['F_CPU=' + str(self.f_cpu)]

        if self.ver:
            cmd += ['ARDUINO_VER=' + self.ver]

        if self.extra_lib:
            cmd += ['EXTRA_LIB=' + self.extra_lib]

        return cmd
1233510
def get_command(arguments):
    
    cmds = list(filter(lambda k: not (k.startswith('-') or
                                 k.startswith('<')) and arguments[k],
                  arguments.keys()))
    if len(cmds) != 1:
        raise Exception('invalid command line!')
    return cmds[0]
471932
def cmd_as_file(cmd, *args, **kwargs):
    """"""
    kwargs['stdout'] = subprocess.PIPE
    stdin = kwargs.pop('stdin', None)
    if isinstance(stdin, basestring):
        with tempfile.TemporaryFile() as stdin_file:
            stdin_file.write(stdin)
            stdin_file.seek(0)
            kwargs['stdin'] = stdin_file
            p = subprocess.Popen(cmd, *args, **kwargs)
    else:
        p = subprocess.Popen(cmd, *args, **kwargs)
    try:
        yield p.stdout
    finally:
        p.stdout.close()
        if p.wait():
            raise subprocess.CalledProcessError(p.returncode, cmd)
1200622
def cli_create(argument_list):
    

    parser = argparse.ArgumentParser()
    parser.add_argument("content", help="file or directory")
    # TODO: shouldn't we always process directories recursively?
    parser.add_argument("-r", "--recursive",
                        help="process directories recursively")
    parser.add_argument("-i", "--ignore", nargs="+", action="append",
                        help="patterns to ignore "
                             "(can be given more than once)")
    parser.add_argument("-m", "--manifest", default=None,
                        help="output file (default is stdout)")
    parser.add_argument("-d", "--digest",
                        help="digest(s) to use, comma-separated")

    args = parser.parse_args(argument_list)

    # TODO: remove digest from here, they are created when signing!
    if args.digest is None:
        args.digest = "MD5,SHA1"
    requested_digests = args.digest.split(",")
    use_digests = [_get_digest(digest) for digest in requested_digests]

    if args.recursive:
        entries = multi_path_generator(args.content)
    else:
        entries = single_path_generator(args.content)

    mf = Manifest()

    ignores = ["META-INF/*"]
    if args.ignore:
        ignores.extend(*args.ignore)

    for name, chunks in entries:
        # skip the stuff that we were told to ignore
        if ignores and fnmatches(name, *ignores):
            continue

        sec = mf.create_section(name)

        digests = zip(requested_digests, digest_chunks(chunks(), use_digests))
        for digest_name, digest_value in digests:
            sec[digest_name + "-Digest"] = digest_value

    if args.manifest:
        # we'll output to the manifest file if specified, and we'll
        # even create parent directories for it, if necessary
        makedirsp(split(args.manifest)[0])
        output = open(args.manifest, "wb")
    else:
        output = sys.stdout

    mf.store(output)

    if args.manifest:
        output.close()
497039
def list_running():
    '''
    
    '''
    ret = []
    for line in _machinectl('list')['stdout'].splitlines():
        try:
            ret.append(line.split()[0])
        except IndexError:
            pass
    return sorted(ret)
603255
def main():
    """"""
    actions = []
    try:
        # Parse the command line arguments.
        options, arguments = getopt.getopt(sys.argv[1:], 'cdh', [
            'convert', 'to-html', 'demo', 'help',
        ])
        # Map command line options to actions.
        for option, value in options:
            if option in ('-c', '--convert', '--to-html'):
                actions.append(functools.partial(convert_command_output, *arguments))
                arguments = []
            elif option in ('-d', '--demo'):
                actions.append(demonstrate_colored_logging)
            elif option in ('-h', '--help'):
                usage(__doc__)
                return
            else:
                assert False, "Programming error: Unhandled option!"
        if not actions:
            usage(__doc__)
            return
    except Exception as e:
        warning("Error: %s", e)
        sys.exit(1)
    for function in actions:
        function()
112652
def shell(self, *args, **kwargs):
        
        args = ['shell'] + list(args)
        return self.run_cmd(*args, **kwargs)
62053
def commandline_to_list(self, cmdline_str, trigger_string):
        '''
        
        '''
        cmdline = salt.utils.args.shlex_split(cmdline_str[len(trigger_string):])
        # Remove slack url parsing
        #  Translate target=<http://host.domain.net|host.domain.net>
        #  to target=host.domain.net
        cmdlist = []
        for cmditem in cmdline:
            pattern = r'(?P<begin>.*)(<.*\|)(?P<url>.*)(>)(?P<remainder>.*)'
            mtch = re.match(pattern, cmditem)
            if mtch:
                origtext = mtch.group('begin') + mtch.group('url') + mtch.group('remainder')
                cmdlist.append(origtext)
            else:
                cmdlist.append(cmditem)
        return cmdlist
1023940
def as_list(self):
        ""
        netloc = ''
        if self.vpath_connector:
            netloc = '(('+self.vpath_connector+'))'
        elif self.authority:
            netloc = self.authority
        else:
            netloc = self.netloc
        return [
            self.scheme,
            netloc,
            self.path,
            self.query,
            '',
            ]
74139
def build_list(self):
        """"""
        ret = []
        for p in self.args.stdout.split(','):
            if '.' in p:
                p, a = p.split('.')
            else:
                a = None
            ret.append((p, a))
        return ret
35552
def main():
    
    parser = argparse.ArgumentParser(
        description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter
    )
    parser.add_argument("path", nargs="+", help="File or directory path")
    parser.add_argument("--exclude", nargs="+", help="Exclude glob patterns")
    parser.add_argument(
        "--no-recursive",
        dest="recursive",
        action="store_false",
        help="Search directories recursively",
    )
    parser.add_argument(
        "--ignore-invalid", action="store_true", help="Ignore invalid paths"
    )
    parser.add_argument(
        "--pycharm", action="store_true", help="Enable PyCharm integration"
    )
    parser.add_argument(
        "--diff",
        dest="show_diff",
        action="store_true",
        help="Show diff and do not modify any files",
    )
    parser.add_argument(
        "--dry-run", action="store_true", help="Process files but do not write results"
    )
    parser.add_argument("--debug", action="store_true", help="Debug level logging")

    args = parser.parse_args()
    d1_common.util.log_setup(args.debug)

    repo_path = d1_dev.util.find_repo_root_by_path(__file__)
    repo = git.Repo(repo_path)

    specified_file_path_list = get_specified_file_path_list(args)
    # tracked_path_list = list(d1_dev.util.get_tracked_files(repo))
    # format_path_list = sorted(
    #     set(specified_file_path_list).intersection(tracked_path_list)
    # )
    format_path_list = specified_file_path_list
    for format_path in format_path_list:
        comment_unused_imports(args, format_path)
1140554
def main(args_list=None):
    
    args = parse_args(args_list)
    print("Topiary commandline arguments:")
    print(args)
    df = predict_epitopes_from_args(args)
    write_outputs(df, args)
    print("Total count: %d" % len(df))
1276429
def list(*args, &block) # :yield: line
      cmd = "LIST"
      args.each do |arg|
        cmd = cmd + " " + arg.to_s
      end
      if block
        retrlines(cmd, &block)
      else
        lines = []
        retrlines(cmd) do |line|
          lines << line
        end
        return lines
      end
    end
172580
def _command_and_args(tokens: List[str]) -> Tuple[str, str]:
        
        command = ''
        args = ''

        if tokens:
            command = tokens[0]

        if len(tokens) > 1:
            args = ' '.join(tokens[1:])

        return command, args
301199
def main(args=sys.argv):
    

    parser = create_optparser(args[0])
    return cli(parser.parse_args(args[1:]))
199756
def list_(channel=None):
    '''
    
    '''
    pecl_channel_pat = re.compile('^([^ ]+)[ ]+([^ ]+)[ ]+([^ ]+)')
    pecls = {}
    command = 'list'
    if channel:
        command = '{0} -c {1}'.format(command, _cmd_quote(channel))
    lines = _pecl(command).splitlines()
    lines = (l for l in lines if pecl_channel_pat.match(l))

    for line in lines:
        match = pecl_channel_pat.match(line)
        if match:
            pecls[match.group(1)] = [match.group(2), match.group(3)]

    return pecls
244338
def pack_commands(self, commands):
        ""
        output = []
        pieces = []
        buffer_length = 0

        for cmd in commands:
            for chunk in self.pack_command(*cmd):
                pieces.append(chunk)
                buffer_length += len(chunk)

            if buffer_length > 6000:
                output.append(SYM_EMPTY.join(pieces))
                buffer_length = 0
                pieces = []

        if pieces:
            output.append(SYM_EMPTY.join(pieces))
        return output