forked from platformio/platformio-core
Better informing about deprecated commands
This commit is contained in:
@ -69,13 +69,6 @@ def get_project_global_lib_dir():
|
|||||||
@click.pass_context
|
@click.pass_context
|
||||||
def cli(ctx, **options):
|
def cli(ctx, **options):
|
||||||
in_silence = PlatformioCLI.in_silence()
|
in_silence = PlatformioCLI.in_silence()
|
||||||
if not in_silence:
|
|
||||||
click.secho(
|
|
||||||
"\nWARNING!!! This command is deprecated and will be removed in "
|
|
||||||
"the next releases. \nPlease use `pio pkg` instead.\n",
|
|
||||||
fg="yellow",
|
|
||||||
)
|
|
||||||
|
|
||||||
storage_cmds = ("install", "uninstall", "update", "list")
|
storage_cmds = ("install", "uninstall", "update", "list")
|
||||||
# skip commands that don't need storage folder
|
# skip commands that don't need storage folder
|
||||||
if ctx.invoked_subcommand not in storage_cmds or (
|
if ctx.invoked_subcommand not in storage_cmds or (
|
||||||
@ -148,6 +141,11 @@ def cli(ctx, **options):
|
|||||||
def lib_install( # pylint: disable=too-many-arguments,unused-argument
|
def lib_install( # pylint: disable=too-many-arguments,unused-argument
|
||||||
ctx, libraries, save, silent, interactive, force
|
ctx, libraries, save, silent, interactive, force
|
||||||
):
|
):
|
||||||
|
click.secho(
|
||||||
|
"\nWARNING: This command is deprecated and will be removed in "
|
||||||
|
"the next releases. \nPlease use `pio pkg install` instead.\n",
|
||||||
|
fg="yellow",
|
||||||
|
)
|
||||||
storage_dirs = ctx.meta[CTX_META_STORAGE_DIRS_KEY]
|
storage_dirs = ctx.meta[CTX_META_STORAGE_DIRS_KEY]
|
||||||
storage_libdeps = ctx.meta.get(CTX_META_STORAGE_LIBDEPS_KEY, [])
|
storage_libdeps = ctx.meta.get(CTX_META_STORAGE_LIBDEPS_KEY, [])
|
||||||
|
|
||||||
@ -211,6 +209,11 @@ def _save_deps(ctx, pkgs, action="add"):
|
|||||||
@click.option("-s", "--silent", is_flag=True, help="Suppress progress reporting")
|
@click.option("-s", "--silent", is_flag=True, help="Suppress progress reporting")
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
def lib_uninstall(ctx, libraries, save, silent):
|
def lib_uninstall(ctx, libraries, save, silent):
|
||||||
|
click.secho(
|
||||||
|
"\nWARNING: This command is deprecated and will be removed in "
|
||||||
|
"the next releases. \nPlease use `pio pkg uninstall` instead.\n",
|
||||||
|
fg="yellow",
|
||||||
|
)
|
||||||
storage_dirs = ctx.meta[CTX_META_STORAGE_DIRS_KEY]
|
storage_dirs = ctx.meta[CTX_META_STORAGE_DIRS_KEY]
|
||||||
uninstalled_pkgs = {}
|
uninstalled_pkgs = {}
|
||||||
for storage_dir in storage_dirs:
|
for storage_dir in storage_dirs:
|
||||||
@ -246,6 +249,13 @@ def lib_update( # pylint: disable=too-many-arguments
|
|||||||
"This command is deprecated, please use `pio pkg outdated` instead"
|
"This command is deprecated, please use `pio pkg outdated` instead"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if not json_output:
|
||||||
|
click.secho(
|
||||||
|
"\nWARNING: This command is deprecated and will be removed in "
|
||||||
|
"the next releases. \nPlease use `pio pkg update` instead.\n",
|
||||||
|
fg="yellow",
|
||||||
|
)
|
||||||
|
|
||||||
storage_dirs = ctx.meta[CTX_META_STORAGE_DIRS_KEY]
|
storage_dirs = ctx.meta[CTX_META_STORAGE_DIRS_KEY]
|
||||||
json_result = {}
|
json_result = {}
|
||||||
for storage_dir in storage_dirs:
|
for storage_dir in storage_dirs:
|
||||||
@ -305,6 +315,12 @@ def lib_update( # pylint: disable=too-many-arguments
|
|||||||
@click.option("--json-output", is_flag=True)
|
@click.option("--json-output", is_flag=True)
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
def lib_list(ctx, json_output):
|
def lib_list(ctx, json_output):
|
||||||
|
if not json_output:
|
||||||
|
click.secho(
|
||||||
|
"\nWARNING: This command is deprecated and will be removed in "
|
||||||
|
"the next releases. \nPlease use `pio pkg list` instead.\n",
|
||||||
|
fg="yellow",
|
||||||
|
)
|
||||||
storage_dirs = ctx.meta[CTX_META_STORAGE_DIRS_KEY]
|
storage_dirs = ctx.meta[CTX_META_STORAGE_DIRS_KEY]
|
||||||
json_result = {}
|
json_result = {}
|
||||||
for storage_dir in storage_dirs:
|
for storage_dir in storage_dirs:
|
||||||
@ -348,6 +364,12 @@ def lib_list(ctx, json_output):
|
|||||||
help="Do not prompt, automatically paginate with delay",
|
help="Do not prompt, automatically paginate with delay",
|
||||||
)
|
)
|
||||||
def lib_search(query, json_output, page, noninteractive, **filters):
|
def lib_search(query, json_output, page, noninteractive, **filters):
|
||||||
|
if not json_output:
|
||||||
|
click.secho(
|
||||||
|
"\nWARNING: This command is deprecated and will be removed in "
|
||||||
|
"the next releases. \nPlease use `pio pkg search` instead.\n",
|
||||||
|
fg="yellow",
|
||||||
|
)
|
||||||
regclient = LibraryPackageManager().get_registry_client_instance()
|
regclient = LibraryPackageManager().get_registry_client_instance()
|
||||||
if not query:
|
if not query:
|
||||||
query = []
|
query = []
|
||||||
@ -444,6 +466,12 @@ def lib_builtin(storage, json_output):
|
|||||||
@click.argument("library", metavar="[LIBRARY]")
|
@click.argument("library", metavar="[LIBRARY]")
|
||||||
@click.option("--json-output", is_flag=True)
|
@click.option("--json-output", is_flag=True)
|
||||||
def lib_show(library, json_output):
|
def lib_show(library, json_output):
|
||||||
|
if not json_output:
|
||||||
|
click.secho(
|
||||||
|
"\nWARNING: This command is deprecated and will be removed in "
|
||||||
|
"the next releases. \nPlease use `pio pkg show` instead.\n",
|
||||||
|
fg="yellow",
|
||||||
|
)
|
||||||
lm = LibraryPackageManager()
|
lm = LibraryPackageManager()
|
||||||
lm.set_log_level(logging.ERROR if json_output else logging.DEBUG)
|
lm.set_log_level(logging.ERROR if json_output else logging.DEBUG)
|
||||||
lib_id = lm.reveal_registry_package_id(library)
|
lib_id = lm.reveal_registry_package_id(library)
|
||||||
|
@ -18,7 +18,6 @@ import os
|
|||||||
|
|
||||||
import click
|
import click
|
||||||
|
|
||||||
from platformio.commands import PlatformioCLI
|
|
||||||
from platformio.commands.boards import print_boards
|
from platformio.commands.boards import print_boards
|
||||||
from platformio.exception import UserSideException
|
from platformio.exception import UserSideException
|
||||||
from platformio.package.exception import UnknownPackageError
|
from platformio.package.exception import UnknownPackageError
|
||||||
@ -31,18 +30,19 @@ from platformio.platform.factory import PlatformFactory
|
|||||||
|
|
||||||
@click.group(short_help="Platform manager", hidden=True)
|
@click.group(short_help="Platform manager", hidden=True)
|
||||||
def cli():
|
def cli():
|
||||||
if not PlatformioCLI.in_silence():
|
pass
|
||||||
click.secho(
|
|
||||||
"\nWARNING!!! This command is deprecated and will be removed in "
|
|
||||||
"the next releases. \nPlease use `pio pkg` instead.\n",
|
|
||||||
fg="yellow",
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@cli.command("search", short_help="Search for development platform")
|
@cli.command("search", short_help="Search for development platform")
|
||||||
@click.argument("query", required=False)
|
@click.argument("query", required=False)
|
||||||
@click.option("--json-output", is_flag=True)
|
@click.option("--json-output", is_flag=True)
|
||||||
def platform_search(query, json_output):
|
def platform_search(query, json_output):
|
||||||
|
if not json_output:
|
||||||
|
click.secho(
|
||||||
|
"\nWARNING: This command is deprecated and will be removed in "
|
||||||
|
"the next releases. \nPlease use `pio pkg search` instead.\n",
|
||||||
|
fg="yellow",
|
||||||
|
)
|
||||||
platforms = []
|
platforms = []
|
||||||
for platform in _get_registry_platforms():
|
for platform in _get_registry_platforms():
|
||||||
if query == "all":
|
if query == "all":
|
||||||
@ -94,6 +94,12 @@ def platform_frameworks(query, json_output):
|
|||||||
@cli.command("list", short_help="List installed development platforms")
|
@cli.command("list", short_help="List installed development platforms")
|
||||||
@click.option("--json-output", is_flag=True)
|
@click.option("--json-output", is_flag=True)
|
||||||
def platform_list(json_output):
|
def platform_list(json_output):
|
||||||
|
if not json_output:
|
||||||
|
click.secho(
|
||||||
|
"\nWARNING: This command is deprecated and will be removed in "
|
||||||
|
"the next releases. \nPlease use `pio pkg list` instead.\n",
|
||||||
|
fg="yellow",
|
||||||
|
)
|
||||||
platforms = []
|
platforms = []
|
||||||
pm = PlatformPackageManager()
|
pm = PlatformPackageManager()
|
||||||
for pkg in pm.get_installed():
|
for pkg in pm.get_installed():
|
||||||
@ -112,6 +118,12 @@ def platform_list(json_output):
|
|||||||
@click.argument("platform")
|
@click.argument("platform")
|
||||||
@click.option("--json-output", is_flag=True)
|
@click.option("--json-output", is_flag=True)
|
||||||
def platform_show(platform, json_output): # pylint: disable=too-many-branches
|
def platform_show(platform, json_output): # pylint: disable=too-many-branches
|
||||||
|
if not json_output:
|
||||||
|
click.secho(
|
||||||
|
"\nWARNING: This command is deprecated and will be removed in "
|
||||||
|
"the next releases. \nPlease use `pio pkg show` instead.\n",
|
||||||
|
fg="yellow",
|
||||||
|
)
|
||||||
data = _get_platform_data(platform)
|
data = _get_platform_data(platform)
|
||||||
if not data:
|
if not data:
|
||||||
raise UnknownPlatform(platform)
|
raise UnknownPlatform(platform)
|
||||||
@ -195,6 +207,12 @@ def platform_install( # pylint: disable=too-many-arguments,too-many-locals
|
|||||||
silent,
|
silent,
|
||||||
force,
|
force,
|
||||||
):
|
):
|
||||||
|
click.secho(
|
||||||
|
"\nWARNING: This command is deprecated and will be removed in "
|
||||||
|
"the next releases. \nPlease use `pio pkg install` instead.\n",
|
||||||
|
fg="yellow",
|
||||||
|
)
|
||||||
|
|
||||||
def _find_pkg_names(p, candidates):
|
def _find_pkg_names(p, candidates):
|
||||||
result = []
|
result = []
|
||||||
for candidate in candidates:
|
for candidate in candidates:
|
||||||
@ -251,6 +269,11 @@ def platform_install( # pylint: disable=too-many-arguments,too-many-locals
|
|||||||
@cli.command("uninstall", short_help="Uninstall development platform")
|
@cli.command("uninstall", short_help="Uninstall development platform")
|
||||||
@click.argument("platforms", nargs=-1, required=True, metavar="[PLATFORM...]")
|
@click.argument("platforms", nargs=-1, required=True, metavar="[PLATFORM...]")
|
||||||
def platform_uninstall(platforms):
|
def platform_uninstall(platforms):
|
||||||
|
click.secho(
|
||||||
|
"\nWARNING: This command is deprecated and will be removed in "
|
||||||
|
"the next releases. \nPlease use `pio pkg uninstall` instead.\n",
|
||||||
|
fg="yellow",
|
||||||
|
)
|
||||||
pm = PlatformPackageManager()
|
pm = PlatformPackageManager()
|
||||||
pm.set_log_level(logging.DEBUG)
|
pm.set_log_level(logging.DEBUG)
|
||||||
for platform in platforms:
|
for platform in platforms:
|
||||||
@ -285,6 +308,13 @@ def platform_update( # pylint: disable=too-many-locals, too-many-arguments
|
|||||||
"This command is deprecated, please use `pio pkg outdated` instead"
|
"This command is deprecated, please use `pio pkg outdated` instead"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if not json_output:
|
||||||
|
click.secho(
|
||||||
|
"\nWARNING: This command is deprecated and will be removed in "
|
||||||
|
"the next releases. \nPlease use `pio pkg update` instead.\n",
|
||||||
|
fg="yellow",
|
||||||
|
)
|
||||||
|
|
||||||
pm = PlatformPackageManager()
|
pm = PlatformPackageManager()
|
||||||
pm.set_log_level(logging.WARN if silent else logging.DEBUG)
|
pm.set_log_level(logging.WARN if silent else logging.DEBUG)
|
||||||
platforms = platforms or pm.get_installed()
|
platforms = platforms or pm.get_installed()
|
||||||
|
Reference in New Issue
Block a user