diff --git a/platformio/__main__.py b/platformio/__main__.py index a3de3544..892b36c0 100644 --- a/platformio/__main__.py +++ b/platformio/__main__.py @@ -31,9 +31,23 @@ class PlatformioCLI(click.MultiCommand): # pylint: disable=R0904 mod = __import__("platformio.commands." + name, None, None, ["cli"]) except ImportError: - raise exception.UnknownCLICommand(name) + try: + return self._handle_obsolate_command(name) + except AttributeError: + raise exception.UnknownCLICommand(name) return mod.cli + def _handle_obsolate_command(self, name): + if name in ("install", "list", "search", "show", "uninstall"): + click.secho( + "Warning! `platformio %s` command is obsoleted! Please use " + "`platformio platforms %s`" % (name, name), + fg="red" + ) + from platformio.commands import platforms + return getattr(platforms, "platforms_" + name) + raise AttributeError() + @click.command(cls=PlatformioCLI) @click.version_option(__version__, prog_name="PlatformIO")