mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-31 18:44:27 +02:00
Handle obsoleted commands // Issue #158
This commit is contained in:
@@ -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")
|
||||
|
Reference in New Issue
Block a user