Skip to content

Commit a748e1f

Browse files
committed
Add "*" or "--all" option to update all
1 parent f26ac9f commit a748e1f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

conda.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
Requires conda to already be installed.
1818
options:
1919
name:
20-
description: The name of a Python package to install.
20+
description: The name of a Python package to install. Can be "*" or "--all" combined with state=latest to update
21+
all packages.
2122
required: true
2223
version:
2324
description: The specific version of a package to install.
@@ -91,6 +92,12 @@ def run_package_operation(conda, name, version, state, dry_run, command_runner,
9192
:param on_failure: method that takes any kwargs to be called on failure
9293
:param on_success: method that takes any kwargs to be called on success
9394
"""
95+
# Special case to update all installed packages
96+
if ( name == '*' or name == '--all' ) and state == 'latest':
97+
output, stderr = run_conda_package_command(
98+
command_runner, '--all', None, [conda, 'update', '--json', '--all'])
99+
on_success(changed=True, output=output, stderr=stderr)
100+
94101
correct_version_installed = check_package_installed(command_runner, conda, name, version)
95102

96103
# TODO: State should be an "enum" (or whatever the Py2.7 equivalent is)

0 commit comments

Comments
 (0)