From 6e87089ded56f68ce2088317a9235a7ff7b444e8 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 25 May 2019 22:14:38 +0300 Subject: [PATCH] Add support for Unix shell-style wildcards for "monitor_port" option // Resolve #2541 --- HISTORY.rst | 11 ++++++----- docs | 2 +- platformio/commands/device.py | 7 ++++++- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 9a9b8145..44a6cee6 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -7,15 +7,16 @@ PlatformIO 4.0 4.0.0 (2019-??-??) ~~~~~~~~~~~~~~~~~~ -* **Project Management** +* **Project Configuration** - Unified workspace storage (`workspace_dir `__ -> ``.pio``) for PlatformIO Build System, Library Manager, and other internal services (`issue #1778 `_) - Switched to workspace ``.pio/build`` folder for build artifacts instead of ``.pioenvs`` - - Share common (global) options between build environments using ``[env]`` section in `"platformio.ini" (Project Configuration File) `__ (`issue #1643 `_) - - Include external configuration files in `"platformio.ini" (Project Configuration File) `__ with `extra_configs `__ option (`issue #1590 `_) + - Share common (global) options between project environments using `[env] `__ section (`issue #1643 `_) + - Include external configuration files with `extra_configs `__ option (`issue #1590 `_) - Override default `"platformio.ini" (Project Configuration File) `__ with a custom using ``-c, --project-conf`` option for `platformio run `__, `platformio debug `__, or `platformio test `__ commands (`issue #1913 `_) - - Custom project ``***_dir`` options declared in "platformio" section of `"platformio.ini" (Project Configuration File) `__ have higher priority than `Environment variables `__ - - Added new `monitor_flags `__ option to `"platformio.ini" (Project Configuration File) `__ which allows passing extra flags and options to `platformio device monitor `__ command (`issue #2165 `_) + - Custom project ``***_dir`` options declared in `platformio `__ section have higher priority than `Environment variables `__ + - Added support for Unix shell-style wildcards for `monitor_port `__ option (`issue #2541 `_) + - Added new `monitor_flags `__ option which allows passing extra flags and options to `platformio device monitor `__ command (`issue #2165 `_) * **Library Management** diff --git a/docs b/docs index 158fb3c0..abdccc98 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 158fb3c0484586ef4b87dbd6ef7d780cbe74786c +Subproject commit abdccc987a03354bb80863e98dc109dd6b990cbe diff --git a/platformio/commands/device.py b/platformio/commands/device.py index 9f80062e..c5bde2bd 100644 --- a/platformio/commands/device.py +++ b/platformio/commands/device.py @@ -14,6 +14,7 @@ import json import sys +from fnmatch import fnmatch from os import getcwd from os.path import join @@ -202,7 +203,11 @@ def device_monitor(**kwargs): # pylint: disable=too-many-branches else: sys.argv.extend([k, str(v)]) - print(sys.argv) + if kwargs['port'] and (set(["*", "?", "[", "]"]) & set(kwargs['port'])): + for item in util.get_serial_ports(): + if fnmatch(item['port'], kwargs['port']): + kwargs['port'] = item['port'] + break try: miniterm.main(