1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

homebrew: respect greedy flag for cask upgrade_all (#6267)

* homebrew: respect greedy flag for cask upgrade_all

* homebrew: implement feedback from code review
This commit is contained in:
Claude Becker 2023-04-13 06:41:23 +02:00 committed by GitHub
parent ea8720f572
commit 6c5c05dfdc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- homebrew_cask - allows passing ``--greedy`` option to ``upgrade_all`` (https://github.com/ansible-collections/community.general/pull/6267).

View file

@ -78,8 +78,9 @@ options:
greedy: greedy:
description: description:
- Upgrade casks that auto update. - Upgrade casks that auto update.
- Passes --greedy to brew cask outdated when checking - Passes C(--greedy) to C(brew outdated --cask) when checking
if an installed cask has a newer version available. if an installed cask has a newer version available,
or to C(brew upgrade --cask) when upgrading all casks.
type: bool type: bool
default: false default: false
''' '''
@ -128,6 +129,11 @@ EXAMPLES = '''
community.general.homebrew_cask: community.general.homebrew_cask:
upgrade_all: true upgrade_all: true
- name: Upgrade all casks with greedy option
community.general.homebrew_cask:
upgrade_all: true
greedy: true
- name: Upgrade given cask with force option - name: Upgrade given cask with force option
community.general.homebrew_cask: community.general.homebrew_cask:
name: alfred name: alfred
@ -581,6 +587,9 @@ class HomebrewCask(object):
else: else:
cmd = [self.brew_path, 'cask', 'upgrade'] cmd = [self.brew_path, 'cask', 'upgrade']
if self.greedy:
cmd = cmd + ['--greedy']
rc, out, err = '', '', '' rc, out, err = '', '', ''
if self.sudo_password: if self.sudo_password: