Skip to content

Commit

Permalink
Add "*" or "--all" option to update all
Browse files Browse the repository at this point in the history
  • Loading branch information
opoplawski committed Jan 7, 2019
1 parent f26ac9f commit a748e1f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion conda.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
Requires conda to already be installed.
options:
name:
description: The name of a Python package to install.
description: The name of a Python package to install. Can be "*" or "--all" combined with state=latest to update
all packages.
required: true
version:
description: The specific version of a package to install.
Expand Down Expand Up @@ -91,6 +92,12 @@ def run_package_operation(conda, name, version, state, dry_run, command_runner,
:param on_failure: method that takes any kwargs to be called on failure
:param on_success: method that takes any kwargs to be called on success
"""
# Special case to update all installed packages
if ( name == '*' or name == '--all' ) and state == 'latest':
output, stderr = run_conda_package_command(
command_runner, '--all', None, [conda, 'update', '--json', '--all'])
on_success(changed=True, output=output, stderr=stderr)

correct_version_installed = check_package_installed(command_runner, conda, name, version)

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

0 comments on commit a748e1f

Please sign in to comment.