Add support for Unix shell-style wildcards for "monitor_port" option // Resolve #2541

This commit is contained in:
Ivan Kravets
2019-05-25 22:14:38 +03:00
parent a84195bb5a
commit 6e87089ded
3 changed files with 13 additions and 7 deletions

View File

@@ -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(