mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-29 17:47:14 +02:00
Show valid environment names when user typed unknown values
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
# Copyright (C) Ivan Kravets <me@ikravets.com>
|
||||
# See LICENSE for details.
|
||||
|
||||
VERSION = (2, 3, 3)
|
||||
VERSION = (2, 3, "4.dev0")
|
||||
__version__ = ".".join([str(s) for s in VERSION])
|
||||
|
||||
__title__ = "platformio"
|
||||
|
@ -36,9 +36,12 @@ def cli(ctx, environment, target, upload_port, # pylint: disable=R0913,R0914
|
||||
if not config.sections():
|
||||
raise exception.ProjectEnvsNotAvailable()
|
||||
|
||||
unknown = set(environment) - set([s[4:] for s in config.sections()])
|
||||
known = set([s[4:] for s in config.sections()
|
||||
if s.startswith("env:")])
|
||||
unknown = set(environment) - known
|
||||
if unknown:
|
||||
raise exception.UnknownEnvNames(", ".join(unknown))
|
||||
raise exception.UnknownEnvNames(
|
||||
", ".join(unknown), ", ".join(known))
|
||||
|
||||
# clean obsolete .pioenvs dir
|
||||
if not disable_auto_clean:
|
||||
|
@ -104,17 +104,17 @@ class UnsupportedArchiveType(PlatformioException):
|
||||
|
||||
class ProjectEnvsNotAvailable(PlatformioException):
|
||||
|
||||
MESSAGE = "Please setup environments in `platformio.ini` file."
|
||||
MESSAGE = "Please setup environments in `platformio.ini` file"
|
||||
|
||||
|
||||
class InvalidEnvName(PlatformioException):
|
||||
|
||||
MESSAGE = "Invalid environment '%s'. The name must start " "with 'env:'."
|
||||
MESSAGE = "Invalid environment '%s'. The name must start with 'env:'"
|
||||
|
||||
|
||||
class UnknownEnvNames(PlatformioException):
|
||||
|
||||
MESSAGE = "Unknown environment names '%s'."
|
||||
MESSAGE = "Unknown environment names '%s'. Valid names are '%s'"
|
||||
|
||||
|
||||
class GetSerialPortsError(PlatformioException):
|
||||
|
Reference in New Issue
Block a user