forked from platformio/platformio-core
Warn about unknown device monitor filters // Resolve #4362
This commit is contained in:
@ -18,6 +18,7 @@ PlatformIO Core 6
|
|||||||
|
|
||||||
* Export a ``PIO_UNIT_TESTING`` macro to the project source files and dependent libraries in the |UNITTESTING| mode
|
* Export a ``PIO_UNIT_TESTING`` macro to the project source files and dependent libraries in the |UNITTESTING| mode
|
||||||
* Improved detection of Windows architecture (`issue #4353 <https://github.com/platformio/platformio-core/issues/4353>`_)
|
* Improved detection of Windows architecture (`issue #4353 <https://github.com/platformio/platformio-core/issues/4353>`_)
|
||||||
|
* Warn about unknown `device monitor filters <https://docs.platformio.org/en/latest/core/userguide/device/cmd_monitor.html#filters>`__ (`issue #4362 <https://github.com/platformio/platformio-core/issues/4362>`_)
|
||||||
* Fixed a regression bug when `libArchive <https://docs.platformio.org/en/latest/manifests/library-json/fields/build/libarchive.html>`__ option declared in the `library.json <https://docs.platformio.org/en/latest/manifests/library-json/index.html>`__ manifest was ignored (`issue #4351 <https://github.com/platformio/platformio-core/issues/4351>`_)
|
* Fixed a regression bug when `libArchive <https://docs.platformio.org/en/latest/manifests/library-json/fields/build/libarchive.html>`__ option declared in the `library.json <https://docs.platformio.org/en/latest/manifests/library-json/index.html>`__ manifest was ignored (`issue #4351 <https://github.com/platformio/platformio-core/issues/4351>`_)
|
||||||
* Fixed an issue when the `pio pkg publish <https://docs.platformio.org/en/latest/core/userguide/pkg/cmd_publish.html>`__ command didn't work with Python 3.6 (`issue #4352 <https://github.com/platformio/platformio-core/issues/4352>`_)
|
* Fixed an issue when the `pio pkg publish <https://docs.platformio.org/en/latest/core/userguide/pkg/cmd_publish.html>`__ command didn't work with Python 3.6 (`issue #4352 <https://github.com/platformio/platformio-core/issues/4352>`_)
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ import click
|
|||||||
from platformio import exception, fs
|
from platformio import exception, fs
|
||||||
from platformio.device.finder import find_serial_port
|
from platformio.device.finder import find_serial_port
|
||||||
from platformio.device.monitor.filters.base import register_filters
|
from platformio.device.monitor.filters.base import register_filters
|
||||||
from platformio.device.monitor.terminal import start_terminal
|
from platformio.device.monitor.terminal import get_available_filters, start_terminal
|
||||||
from platformio.platform.factory import PlatformFactory
|
from platformio.platform.factory import PlatformFactory
|
||||||
from platformio.project.config import ProjectConfig
|
from platformio.project.config import ProjectConfig
|
||||||
from platformio.project.exception import NotPlatformIOProjectError
|
from platformio.project.exception import NotPlatformIOProjectError
|
||||||
@ -138,6 +138,17 @@ def device_monitor_cmd(**options):
|
|||||||
"--exit-char can not be the same as --menu-char"
|
"--exit-char can not be the same as --menu-char"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# check for unknown filters
|
||||||
|
known_filters = set(get_available_filters())
|
||||||
|
unknown_filters = set(options["filters"]) - known_filters
|
||||||
|
if unknown_filters:
|
||||||
|
options["filters"] = list(known_filters & set(options["filters"]))
|
||||||
|
click.secho(
|
||||||
|
("Warning! Skipping unknown filters `%s`. Known filters are `%s`")
|
||||||
|
% (", ".join(unknown_filters), ", ".join(sorted(known_filters))),
|
||||||
|
fg="yellow",
|
||||||
|
)
|
||||||
|
|
||||||
start_terminal(options)
|
start_terminal(options)
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,6 +41,10 @@ class Terminal(miniterm.Miniterm):
|
|||||||
self.pio_unexpected_exception = exc
|
self.pio_unexpected_exception = exc
|
||||||
|
|
||||||
|
|
||||||
|
def get_available_filters():
|
||||||
|
return sorted(miniterm.TRANSFORMATIONS.keys())
|
||||||
|
|
||||||
|
|
||||||
def start_terminal(options):
|
def start_terminal(options):
|
||||||
retries = 0
|
retries = 0
|
||||||
is_port_valid = False
|
is_port_valid = False
|
||||||
@ -116,7 +120,7 @@ def print_terminal_settings(terminal):
|
|||||||
)
|
)
|
||||||
click.echo(
|
click.echo(
|
||||||
"--- Available filters and text transformations: %s"
|
"--- Available filters and text transformations: %s"
|
||||||
% ", ".join(sorted(miniterm.TRANSFORMATIONS.keys()))
|
% ", ".join(get_available_filters())
|
||||||
)
|
)
|
||||||
click.echo("--- More details at https://bit.ly/pio-monitor-filters")
|
click.echo("--- More details at https://bit.ly/pio-monitor-filters")
|
||||||
click.echo(
|
click.echo(
|
||||||
|
Reference in New Issue
Block a user