How to use thefuck - 10 common examples

To help you get started, we’ve selected a few thefuck examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nvbn / thefuck / tests / test_conf.py View on Github external
def test_settings_defaults(load_source, settings):
    load_source.return_value = object()
    settings.init()
    for key, val in const.DEFAULT_SETTINGS.items():
        assert getattr(settings, key) == val
github nvbn / thefuck / tests / rules / test_apt_get.py View on Github external
    (Command('', ''), [], None),
    (Command('vim', 'vim: command not found'),
     ['vim'], '/usr/bin/vim'),
    (Command('sudo vim', 'vim: command not found'),
     ['vim'], '/usr/bin/vim')])
def test_not_match(mocker, command, packages, which):
    mocker.patch('thefuck.rules.apt_get.which', return_value=which)
    mocker.patch('thefuck.rules.apt_get._get_packages',
                 create=True, return_value=packages)

    assert not match(command)
github nvbn / thefuck / tests / rules / test_git_flag_after_filename.py View on Github external
    Command('git log README.md', ''),
    Command('git log -p README.md', '')])
def test_not_match(command):
    assert not match(command)
github nvbn / thefuck / tests / rules / test_php_s.py View on Github external
    Command('php -S localhost:8000', ''),
    Command('vim php -s', '')
])
def test_not_match(command):
    assert not match(command)
github nvbn / thefuck / tests / rules / test_npm_missing_script.py View on Github external
    Command('npm run live-tes', output('live-tes')),
    Command('npm run-script sahare', output('sahare'))])
def test_match(command):
    assert match(command)
github nvbn / thefuck / tests / rules / test_go_run.py View on Github external
    (Command('go run foo', ''), 'go run foo.go'),
    (Command('go run bar', ''), 'go run bar.go')])
def test_get_new_command(command, new_command):
    assert get_new_command(command) == new_command
github nvbn / thefuck / tests / rules / test_mvn_unknown_lifecycle_phase.py View on Github external
    Command('mvn -v', '')
])
def test_not_match(command):
    assert not match(command)
github nvbn / thefuck / tests / rules / test_yarn_command_not_found.py View on Github external
    (Command('yarn require lodash', output('require')),
     'yarn add lodash')])
def test_get_new_command(command, result):
    fixed_command = get_new_command(command)
    if isinstance(fixed_command, list):
        fixed_command = fixed_command[0]

    assert fixed_command == result
github nvbn / thefuck / tests / rules / test_switch_lang.py View on Github external
    Command(u'녀애 ㅣㄴ', 'command not found: 녀애 ㅣㄴ')])
def test_match(command):
    assert switch_lang.match(command)
github nvbn / thefuck / tests / rules / test_git_branch_exists.py View on Github external
def test_not_match(script):
    assert not match(Command(script, ''))