Replace "--only-check" CLI option by "--dry-run"

This commit is contained in:
Ivan Kravets
2019-05-16 20:02:45 +03:00
parent b14abeff48
commit aaf61082c1
7 changed files with 35 additions and 10 deletions

View File

@ -18,6 +18,7 @@ PlatformIO 4.0
* Override default source and include directories for a library via `library.json <http://docs.platformio.org/page/librarymanager/config.html>`__ manifest using ``includeDir`` and ``srcDir`` fields
* Added support for the latest Python "Click" package (CLI Builder)
(`issue #349 <https://github.com/platformio/platformio-core/issues/349>`_)
* Deprecated ``--only-check`` CLI option for "update" sub-commands, please use ``--dry-run`` instead
PlatformIO 3.0
--------------

2
docs

Submodule docs updated: 700a8ac467...6e0004755a

View File

@ -123,13 +123,19 @@ def lib_uninstall(lm, libraries):
"-c",
"--only-check",
is_flag=True,
help="Do not update, only check for new version")
help="DEPRECATED. Please use `--dry-run` instead")
@click.option(
"--dry-run",
is_flag=True,
help="Do not update, only check for the new versions")
@click.option("--json-output", is_flag=True)
@click.pass_obj
def lib_update(lm, libraries, only_check, json_output):
def lib_update(lm, libraries, only_check, dry_run, json_output):
if not libraries:
libraries = [manifest['__pkg_dir'] for manifest in lm.get_installed()]
only_check = dry_run or only_check
if only_check and json_output:
result = []
for library in libraries:

View File

@ -329,9 +329,14 @@ def platform_uninstall(platforms):
"-c",
"--only-check",
is_flag=True,
help="Do not update, only check for a new version")
help="DEPRECATED. Please use `--dry-run` instead")
@click.option(
"--dry-run",
is_flag=True,
help="Do not update, only check for the new versions")
@click.option("--json-output", is_flag=True)
def platform_update(platforms, only_packages, only_check, json_output):
def platform_update(platforms, only_packages, only_check, dry_run,
json_output):
pm = PlatformManager()
pkg_dir_to_name = {}
if not platforms:
@ -341,6 +346,8 @@ def platform_update(platforms, only_packages, only_check, json_output):
pkg_dir_to_name[manifest['__pkg_dir']] = manifest.get(
"title", manifest['name'])
only_check = dry_run or only_check
if only_check and json_output:
result = []
for platform in platforms:

View File

@ -68,8 +68,12 @@ def remote_agent_list():
"-c",
"--only-check",
is_flag=True,
help="Do not update, only check for new version")
def remote_update(only_check):
help="DEPRECATED. Please use `--dry-run` instead")
@click.option(
"--dry-run",
is_flag=True,
help="Do not update, only check for the new versions")
def remote_update(only_check, dry_run):
pioplus_call(sys.argv[1:])

View File

@ -29,12 +29,19 @@ from platformio.managers.lib import LibraryManager
"-c",
"--only-check",
is_flag=True,
help="Do not update, only check for new version")
help="DEPRECATED. Please use `--dry-run` instead")
@click.option(
"--dry-run",
is_flag=True,
help="Do not update, only check for the new versions")
@click.option("--json-output", is_flag=True)
@click.pass_context
def cli(ctx, core_packages, only_check):
def cli(ctx, core_packages, only_check, dry_run):
# cleanup lib search results, cached board and platform lists
app.clean_cache()
only_check = dry_run or only_check
update_core_packages(only_check)
if core_packages:

View File

@ -329,7 +329,7 @@ def check_internal_updates(ctx, what):
fg="yellow",
nl=False)
click.secho(
"`platformio %s update --only-check`" %
"`platformio %s update --dry-run`" %
("lib --global" if what == "libraries" else "platform"),
fg="cyan",
nl=False)