Add apt_upgrade rule (#761)
* apt_list_upgradable: Prepend sudo to suggestion if used in command * Add apt_upgrade rule This suggests `apt upgrade` after `apt list --upgradable` if there are packages to upgrade. It pairs well with the `apt_list_upgradable` rule, which suggests `apt list --upgradable` after `apt update` if there are packages to upgrade. * Add apt_upgrade rule to README
This commit is contained in:
committed by
Vladimir Iakovlev
parent
7e6d1dbc7c
commit
a696461cd3
@@ -11,5 +11,6 @@ def match(command):
|
||||
return "Run 'apt list --upgradable' to see them." in command.output
|
||||
|
||||
|
||||
@sudo_support
|
||||
def get_new_command(command):
|
||||
return 'apt list --upgradable'
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
from thefuck.specific.apt import apt_available
|
||||
from thefuck.specific.sudo import sudo_support
|
||||
from thefuck.utils import for_app
|
||||
|
||||
enabled_by_default = apt_available
|
||||
|
||||
|
||||
@sudo_support
|
||||
@for_app('apt')
|
||||
def match(command):
|
||||
return command.script == "apt list --upgradable" and len(command.output.strip().split('\n')) > 1
|
||||
|
||||
|
||||
@sudo_support
|
||||
def get_new_command(command):
|
||||
return 'apt upgrade'
|
||||
Reference in New Issue
Block a user