コード例 #1
0
ファイル: vagrant_up.py プロジェクト: DJMIN/thefuck
def get_new_command(command):
    cmds = command.script.split(' ')
    machine = None
    if len(cmds) >= 3:
        machine = cmds[2]

    startAllInstances = shells.and_("vagrant up", command.script)
    if machine is None: 
        return startAllInstances
    else:
        return [ shells.and_("vagrant up " +  machine, command.script), startAllInstances]
コード例 #2
0
def get_new_command(command):
    cmds = command.script_parts
    machine = None
    if len(cmds) >= 3:
        machine = cmds[2]

    startAllInstances = shells.and_("vagrant up", command.script)
    if machine is None:
        return startAllInstances
    else:
        return [
            shells.and_("vagrant up " + machine, command.script),
            startAllInstances
        ]
コード例 #3
0
ファイル: git_add.py プロジェクト: SanketDG/thefuck
def get_new_command(command, settings):
    missing_file = re.findall(
            r"error: pathspec '([^']*)' "
            "did not match any file\(s\) known to git.", command.stderr)[0]

    formatme = shells.and_('git add -- {}', '{}')
    return formatme.format(missing_file, command.script)
コード例 #4
0
def get_new_command(command, settings):
    missing_file = re.findall(
        r"error: pathspec '([^']*)' "
        r"did not match any file\(s\) known to git.", command.stderr)[0]

    formatme = shells.and_('git add -- {}', '{}')
    return formatme.format(missing_file, command.script)
コード例 #5
0
def get_new_command(command, settings):
    m = _search(command.stderr)

    # Note: there does not seem to be a standard for columns, so they are just
    # ignored for now
    return shells.and_(
        '{} {} +{}'.format(os.environ['EDITOR'], m.group('file'),
                           m.group('line')), command.script)
コード例 #6
0
def get_new_command(command, settings):
    packages = get_pkgfile(command.script)

    formatme = shells.and_('{} -S {}', '{}')
    return [
        formatme.format(pacman, package, command.script)
        for package in packages
    ]
コード例 #7
0
def get_new_command(command):
    for pattern in patterns:
        file = re.findall(pattern, command.stderr)

        if file:
            file = file[0]
            dir = file[0:file.rfind('/')]

            formatme = shells.and_('mkdir -p {}', '{}')
            return formatme.format(dir, command.script)
コード例 #8
0
ファイル: no_such_file.py プロジェクト: ApeironWang/thefuck
def get_new_command(command, settings):
    for pattern in patterns:
        file = re.findall(pattern, command.stderr)

        if file:
            file = file[0]
            dir = file[0:file.rfind('/')]

            formatme = shells.and_('mkdir -p {}', '{}')
            return formatme.format(dir, command.script)
コード例 #9
0
def get_new_command(command, settings):
    missing_file = re.findall(
        r"error: pathspec '([^']*)' "
        "did not match any file\(s\) known to git.", command.stderr)[0]
    closest_branch = utils.get_closest(missing_file, get_branches(),
                                       fallback_to_first=False)
    if closest_branch:
        return replace_argument(command.script, missing_file, closest_branch)
    else:
        return shells.and_('git branch {}', '{}').format(
            missing_file, command.script)
コード例 #10
0
ファイル: git_checkout.py プロジェクト: MJerty/thefuck
def get_new_command(command):
    missing_file = re.findall(
        r"error: pathspec '([^']*)' "
        r"did not match any file\(s\) known to git.", command.stderr)[0]
    closest_branch = utils.get_closest(missing_file, get_branches(),
                                       fallback_to_first=False)
    if closest_branch:
        return replace_argument(command.script, missing_file, closest_branch)
    else:
        return shells.and_('git branch {}', '{}').format(
            missing_file, command.script)
コード例 #11
0
ファイル: fix_file.py プロジェクト: ngphat/thefuck
def get_new_command(command, settings):
    m = _search(command.stderr) or _search(command.stdout)

    # Note: there does not seem to be a standard for columns, so they are just
    # ignored by default
    if settings.fixcolcmd and "col" in m.groupdict():
        editor_call = settings.fixcolcmd.format(
            editor=os.environ["EDITOR"], file=m.group("file"), line=m.group("line"), col=m.group("col")
        )
    else:
        editor_call = settings.fixlinecmd.format(
            editor=os.environ["EDITOR"], file=m.group("file"), line=m.group("line")
        )

    return shells.and_(editor_call, command.script)
コード例 #12
0
ファイル: fix_file.py プロジェクト: zeusdeux/thefuck
def get_new_command(command):
    m = _search(command.stderr) or _search(command.stdout)

    # Note: there does not seem to be a standard for columns, so they are just
    # ignored by default
    if settings.fixcolcmd and 'col' in m.groupdict():
        editor_call = settings.fixcolcmd.format(editor=os.environ['EDITOR'],
                                                file=m.group('file'),
                                                line=m.group('line'),
                                                col=m.group('col'))
    else:
        editor_call = settings.fixlinecmd.format(editor=os.environ['EDITOR'],
                                                 file=m.group('file'),
                                                 line=m.group('line'))

    return shells.and_(editor_call, command.script)
コード例 #13
0
ファイル: git_pull.py プロジェクト: subajat1/thefuck
def get_new_command(command, settings):
    line = command.stderr.split('\n')[-3].strip()
    branch = line.split(' ')[-1]
    set_upstream = line.replace('<remote>', 'origin')\
                       .replace('<branch>', branch)
    return shells.and_(set_upstream, command.script)
コード例 #14
0
ファイル: git_push_pull.py プロジェクト: Aftermath/thefuck
def get_new_command(command, settings):
    return shells.and_(replace_argument(command.script, "push", "pull"), command.script)
コード例 #15
0
ファイル: apt_get.py プロジェクト: ApeironWang/thefuck
def get_new_command(command, settings):
    c = CommandNotFound.CommandNotFound()
    pkgs = c.getPackages(command.script.split(" ")[0])
    name, _ = pkgs[0]
    formatme = shells.and_('sudo apt-get install {}', '{}')
    return formatme.format(name, command.script)
コード例 #16
0
ファイル: git_push_pull.py プロジェクト: SanketDG/thefuck
def get_new_command(command, settings):
    return and_(replace_argument(command.script, 'push', 'pull'),
                command.script)
コード例 #17
0
def get_new_command(command, settings):
    return shells.and_('mkdir -p {dir}', '{cmd} -C {dir}') \
                 .format(dir=_tar_file(command.script)[1], cmd=command.script)
コード例 #18
0
ファイル: git_pull.py プロジェクト: tcfunk/thefuck
def get_new_command(command, settings):
    line = command.stderr.split('\n')[-3].strip()
    branch = line.split(' ')[-1]
    set_upstream = line.replace('<remote>', 'origin')\
                       .replace('<branch>', branch)
    return shells.and_(set_upstream, command.script)
コード例 #19
0
ファイル: apt_get.py プロジェクト: vladmysiur/konspekt
def get_new_command(command):
    name = get_package(command.script)
    formatme = shells.and_('sudo apt-get install {}', '{}')
    return formatme.format(name, command.script)
コード例 #20
0
ファイル: git_push_pull.py プロジェクト: MJerty/thefuck
def get_new_command(command):
    return shells.and_(replace_argument(command.script, 'push', 'pull'),
                       command.script)
コード例 #21
0
def get_new_command(command):
    return shells.and_(replace_argument(command.script, 'push', 'pull'),
                       command.script)
コード例 #22
0
ファイル: pacman.py プロジェクト: Jipoker/thefuck
def get_new_command(command, settings):
    packages = __get_pkgfile(command)

    formatme = shells.and_('{} -S {}', '{}')
    return [formatme.format(pacman, package, command.script)
            for package in packages]
コード例 #23
0
def get_new_command(command, settings):
    package = __get_pkgfile(command)[0]

    formatme = shells.and_('{} -S {}', '{}')
    return formatme.format(pacman, package, command.script)
コード例 #24
0
def get_new_command(command):
    return shells.and_('tsuru login', command.script)
コード例 #25
0
ファイル: dirty_untar.py プロジェクト: wzkacxl/thefuck
def get_new_command(command):
    dir = shells.quote(_tar_file(command.script_parts)[1])
    return shells.and_('mkdir -p {dir}', '{cmd} -C {dir}') \
        .format(dir=dir, cmd=command.script)
コード例 #26
0
def get_new_command(command, settings):
    return shells.and_('git branch --delete list', 'git branch')
コード例 #27
0
ファイル: cd_mkdir.py プロジェクト: yan96in/thefuck
def get_new_command(command):
    repl = shells.and_('mkdir -p \\1', 'cd \\1')
    return re.sub(r'^cd (.*)', repl, command.script)
コード例 #28
0
ファイル: dirty_untar.py プロジェクト: flying-potato/thefuck
def get_new_command(command):
    dir = shells.quote(_tar_file(command.script_parts)[1])
    return shells.and_('mkdir -p {dir}', '{cmd} -C {dir}') \
        .format(dir=dir, cmd=command.script)
コード例 #29
0
ファイル: touch.py プロジェクト: vladmysiur/konspekt
def get_new_command(command):
    path = re.findall(r"touch: cannot touch '(.+)/.+':", command.stderr)[0]
    return and_(u'mkdir -p {}'.format(path), command.script)
コード例 #30
0
ファイル: dirty_untar.py プロジェクト: DJMIN/thefuck
def get_new_command(command):
    return shells.and_("mkdir -p {dir}", "{cmd} -C {dir}").format(dir=_tar_file(command.script)[1], cmd=command.script)
コード例 #31
0
def test_get_new_command():
    assert (get_new_command(Command('git branch list')) == shells.and_(
        'git branch --delete list', 'git branch'))
コード例 #32
0
ファイル: git_stash.py プロジェクト: vladmysiur/konspekt
def get_new_command(command):
    formatme = shells.and_('git stash', '{}')
    return formatme.format(command.script)
コード例 #33
0
ファイル: git_branch_list.py プロジェクト: Aftermath/thefuck
def get_new_command(command, settings):
    return shells.and_("git branch --delete list", "git branch")
コード例 #34
0
ファイル: dirty_untar.py プロジェクト: roth1002/thefuck
def get_new_command(command, settings):
    return shells.and_('mkdir -p {dir}', '{cmd} -C {dir}') \
        .format(dir=_tar_file(command.script)[1], cmd=command.script)
コード例 #35
0
def test_get_new_command():
    assert (get_new_command(Command('git branch list'), None) ==
            shells.and_('git branch --delete list', 'git branch'))
コード例 #36
0
ファイル: cd_mkdir.py プロジェクト: amir-s/thefuck
def get_new_command(command):
    repl = shells.and_('mkdir -p \\1', 'cd \\1')
    return re.sub(r'^cd (.*)', repl, command.script)
コード例 #37
0
def get_new_command(command, settings):
    return and_(command.script.replace('push', 'pull'),
                command.script)
コード例 #38
0
ファイル: apt_get.py プロジェクト: tiandee/thefuck
def get_new_command(command, settings):
    c = CommandNotFound.CommandNotFound()
    pkgs = c.getPackages(command.script.split(" ")[0])
    name, _ = pkgs[0]
    formatme = shells.and_('sudo apt-get install {}', '{}')
    return formatme.format(name, command.script)
コード例 #39
0
ファイル: fix_file.py プロジェクト: Jipoker/thefuck
def get_new_command(command, settings):
    m = _search(command.stderr)

    # Note: there does not seem to be a standard for columns, so they are just
    # ignored for now
    return shells.and_("{} {} +{}".format(os.environ["EDITOR"], m.group("file"), m.group("line")), command.script)