Allow to choose which library to update // Resolve #168

This commit is contained in:
Ivan Kravets
2015-04-16 17:34:22 +01:00
parent 8d75194884
commit a9942e675f
3 changed files with 35 additions and 4 deletions

View File

@ -1,6 +1,15 @@
Release History
===============
2.0.0 (2015-??-??)
------------------
* Added global ``-f, --force`` option which will force to accept any
confirmation prompts (`issue #152 <https://github.com/platformio/platformio/issues/152>`_)
* Allowed to choose which library to update
(`issue #168 <https://github.com/platformio/platformio/issues/168>`_)
1.4.0 (2015-04-11)
------------------

View File

@ -10,7 +10,7 @@ Usage
.. code-block:: bash
platformio lib update
platformio lib update [LIBRARY_ID]
Description
@ -22,6 +22,8 @@ Check or update installed libraries
Examples
--------
1. Update all installed libraries
.. code-block:: bash
$ platformio lib update
@ -36,8 +38,23 @@ Examples
# Updating [ 13 ] Adafruit-GFX library:
# Versions: Current=a9e5bc4707, Latest=a9e5bc4707 [Up-to-date]
# Updating [ 1 ] OneWire library:
# Versions: Current=2.2, Latest=2.2 [Up-to-date]
# Versions: Current=2.2, Latest=2.2 [Up-to-date]
# Updating [ 4 ] IRremote library:
# Versions: Current=f2dafe5030, Latest=f2dafe5030 [Up-to-date]
# Updating [ 14 ] Adafruit-9DOF-Unified library:
# Versions: Current=b2f07242ac, Latest=b2f07242ac [Up-to-date]
2. Update specified libraries
.. code-block:: bash
$ platformio lib update 1 59
# Updating [ 1 ] OneWire library:
# Versions: Current=2.2, Latest=2.2 [Up-to-date]
# Updating [ 59 ] USB-Host-Shield-20 library:
# Versions: Current=fcab83dcb3, Latest=c61f9ce1c2 [Out-of-date]
# The library #59 'USB-Host-Shield-20' has been successfully uninstalled!
# Installing library [ 59 ]:
# Downloading [####################################] 100%
# Unpacking [####################################] 100%
# The library #59 'USB-Host-Shield-20' has been successfully installed!

View File

@ -209,13 +209,18 @@ def lib_show(libid):
@cli.command("update", short_help="Update installed libraries")
@click.argument("libid", type=click.INT, nargs=-1, required=False,
metavar="[LIBRARY_ID]")
@click.pass_context
def lib_update(ctx):
def lib_update(ctx, libid):
lm = LibraryManager(get_lib_dir())
for id_, latest_version in (lm.get_latest_versions() or {}).items():
if libid and int(id_) not in libid:
continue
info = lm.get_info(int(id_))
click.echo("Updating [ %s ] %s library:" % (
click.echo("Updating [ %s ] %s library:" % (
click.style(id_, fg="yellow"),
click.style(info['name'], fg="cyan")))