mirror of
https://github.com/nvbn/thefuck.git
synced 2025-02-20 20:09:07 +00:00
Merge pull request #240 from diezcami/brew-upgrade
Added brew_upgrade rule
This commit is contained in:
commit
c47968a180
@ -192,6 +192,7 @@ Enabled by default only on specific platforms:
|
||||
* `apt_get` – installs app from apt if it not installed;
|
||||
* `brew_install` – fixes formula name for `brew install`;
|
||||
* `brew_unknown_command` – fixes wrong brew commands, for example `brew docto/brew doctor`;
|
||||
* `brew_upgrade` – appends `--all` to `brew upgrade` as per Homebrew's new behaviour
|
||||
* `pacman` – installs app with `pacman` or `yaourt` if it is not installed.
|
||||
|
||||
Bundled, but not enabled by default:
|
||||
|
15
tests/rules/test_brew_upgrade.py
Normal file
15
tests/rules/test_brew_upgrade.py
Normal file
@ -0,0 +1,15 @@
|
||||
import pytest
|
||||
from thefuck.rules.brew_upgrade import match, get_new_command
|
||||
from tests.utils import Command
|
||||
|
||||
|
||||
@pytest.mark.parametrize('command', [
|
||||
Command(script='brew upgrade')])
|
||||
def test_match(command):
|
||||
assert match(command, None)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('command, new_command', [
|
||||
(Command('brew upgrade'), 'brew upgrade --all')])
|
||||
def test_get_new_command(command, new_command):
|
||||
assert get_new_command(command, None) == new_command
|
14
thefuck/rules/brew_upgrade.py
Normal file
14
thefuck/rules/brew_upgrade.py
Normal file
@ -0,0 +1,14 @@
|
||||
# Appends --all to the brew upgrade command
|
||||
#
|
||||
# Example:
|
||||
# > brew upgrade
|
||||
# Warning: brew upgrade with no arguments will change behaviour soon!
|
||||
# It currently upgrades all formula but this will soon change to require '--all'.
|
||||
#
|
||||
#
|
||||
|
||||
def match(command, settings):
|
||||
return (command.script == 'brew upgrade')
|
||||
|
||||
def get_new_command(command, settings):
|
||||
return command.script + ' --all'
|
Loading…
x
Reference in New Issue
Block a user