2014-06-13 20:47:02 +03:00
|
|
|
# Copyright (C) Ivan Kravets <me@ikravets.com>
|
|
|
|
# See LICENSE for details.
|
|
|
|
|
|
|
|
from os.path import join
|
|
|
|
|
|
|
|
from click import argument, command, echo, style
|
|
|
|
|
|
|
|
from platformio.exception import PlatformNotInstalledYet
|
|
|
|
from platformio.pkgmanager import PackageManager
|
2014-07-30 22:40:11 +03:00
|
|
|
from platformio.platforms.base import PlatformFactory
|
2014-06-13 20:47:02 +03:00
|
|
|
|
|
|
|
|
2014-09-04 18:57:13 +03:00
|
|
|
@command("show", short_help="Show details about installed platforms")
|
2014-06-13 20:47:02 +03:00
|
|
|
@argument("platform")
|
|
|
|
def cli(platform):
|
|
|
|
p = PlatformFactory().newPlatform(platform)
|
|
|
|
if platform not in PackageManager.get_installed():
|
|
|
|
raise PlatformNotInstalledYet(platform)
|
|
|
|
|
|
|
|
# print info about platform
|
|
|
|
echo("{name:<20} - {info}".format(name=style(p.get_name(), fg="cyan"),
|
|
|
|
info=p.get_short_info()))
|
|
|
|
|
|
|
|
pm = PackageManager(platform)
|
2014-07-30 22:40:11 +03:00
|
|
|
for name, data in pm.get_installed(platform).items():
|
2014-07-30 23:39:01 +03:00
|
|
|
pkgalias = p.get_pkg_alias(name)
|
2014-06-13 20:47:02 +03:00
|
|
|
echo("----------")
|
|
|
|
echo("Package: %s" % style(name, fg="yellow"))
|
2014-07-30 23:39:01 +03:00
|
|
|
if pkgalias:
|
|
|
|
echo("Alias: %s" % pkgalias)
|
2014-06-13 20:47:02 +03:00
|
|
|
echo("Location: %s" % join(pm.get_platform_dir(), data['path']))
|
|
|
|
echo("Version: %d" % int(data['version']))
|