Skip to content

Commit

Permalink
add feature on selecting brain based on brains' unique ID
Browse files Browse the repository at this point in the history
  • Loading branch information
Rocky14683 committed Feb 2, 2024
1 parent c14afb0 commit 32f8b5f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pros/cli/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])),
brain_id = click.prompt('Multiple {} Brains were found. Please choose one to upload the program: [{}]'
.format('v5', ' | '.join([p.description.split(' ')[-1] for p in ports])),
default=ports[0].device,
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
Expand Down

0 comments on commit 32f8b5f

Please sign in to comment.