From 3998579e9161a42552b8dfaeb1b4b62f7cca51c1 Mon Sep 17 00:00:00 2001 From: THERocky <101498190+Rocky14683@users.noreply.github.com> Date: Thu, 15 Feb 2024 19:44:36 -0500 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Port=20selection=20(#326)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Found a typo * add feature on selecting brain based on brains' unique ID --- pros/cli/common.py | 10 ++++++---- pros/cli/upload.py | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pros/cli/common.py b/pros/cli/common.py index 71c589c3..d658c7eb 100644 --- a/pros/cli/common.py +++ b/pros/cli/common.py @@ -253,11 +253,13 @@ def resolve_v5_port(port: Optional[str], type: str, quiet: bool = False) -> Tupl return None, False if len(ports) > 1: if not quiet: - port = click.prompt('Multiple {} ports were found. Please choose one: [{}]' - .format('v5', '|'.join([p.device for p in ports])), - default=ports[0].device, + brain_id = click.prompt('Multiple {} Brains were found. Please choose one to upload the program: [{}]' + .format('v5', ' | '.join([p.product.split(' ')[-1] for p in ports])), + default=ports[0].product.split(' ')[-1], show_default=False, - type=click.Choice([p.device for p in ports])) + type=click.Choice([p.description.split(' ')[-1] for p in ports])) + port = [p.device for p in ports if p.description.split(' ')[-1] == brain_id][0] + assert port in [p.device for p in ports] else: return None, False diff --git a/pros/cli/upload.py b/pros/cli/upload.py index 545609a4..5a50f3bd 100644 --- a/pros/cli/upload.py +++ b/pros/cli/upload.py @@ -192,7 +192,7 @@ def __str__(self): result.append(PortReport('VEX EDR V5 System Ports', ports, 'v5/system')) ports = find_v5_ports('User') - result.append(PortReport('VEX EDR V5 User ports', ports, 'v5/user')) + result.append(PortReport('VEX EDR V5 User Ports', ports, 'v5/user')) if target == 'cortex' or target is None: ports = find_cortex_ports() result.append(PortReport('VEX EDR Cortex Microcontroller Ports', ports, 'cortex'))