From 6ea49910d5068ffade82ea5468e027ee8f0d502f Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 18 Jul 2019 00:19:30 +0300 Subject: [PATCH] Fixed an issue when "debug", "home", "run", and "test" commands were not shown in "platformio --help" CLI --- HISTORY.rst | 1 + platformio/commands/__init__.py | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 54ce9c93..5cdacecc 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -14,6 +14,7 @@ PlatformIO 4.0 * Improved computing of project check sum (structure, configuration) and avoid unnecessary rebuilding * Renamed "enable_ssl" setting to `strict_ssl `__ * Fixed an issue with incorrect escaping of Windows slashes when using `PIO Unified Debugger `__ and "piped" openOCD +* Fixed an issue when "debug", "home", "run", and "test" commands were not shown in "platformio --help" CLI 4.0.0 (2019-07-10) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/commands/__init__.py b/platformio/commands/__init__.py index 7dc69d58..5d53349e 100644 --- a/platformio/commands/__init__.py +++ b/platformio/commands/__init__.py @@ -13,7 +13,7 @@ # limitations under the License. import os -from os.path import dirname +from os.path import dirname, isfile, join import click @@ -38,11 +38,14 @@ class PlatformioCLI(click.MultiCommand): def list_commands(self, ctx): cmds = [] - for filename in os.listdir(dirname(__file__)): - if filename.startswith("__init__"): + cmds_dir = dirname(__file__) + for name in os.listdir(cmds_dir): + if name.startswith("__init__"): continue - if filename.endswith(".py"): - cmds.append(filename[:-3]) + if isfile(join(cmds_dir, name, "command.py")): + cmds.append(name) + elif name.endswith(".py"): + cmds.append(name[:-3]) cmds.sort() return cmds