Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

Print probe list when multiple probes were found #126

Merged
merged 1 commit into from
Dec 21, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ fn notmain() -> Result<i32, anyhow::Error> {
logger::init(opts.verbose);

if opts.list_probes {
return print_probes();
return print_probes(Probe::list_all());
}

if opts.list_chips {
Expand Down Expand Up @@ -301,6 +301,7 @@ fn notmain() -> Result<i32, anyhow::Error> {
}
log::debug!("found {} probes", probes.len());
if probes.len() > 1 {
let _ = print_probes(probes);
bail!("more than one probe found; use --probe to specify which one to use");
}
let mut probe = probes[0].open()?;
Expand Down Expand Up @@ -852,9 +853,7 @@ fn probes_filter(probes: &[DebugProbeInfo], selector: &DebugProbeSelector) -> Ve
.collect()
}

fn print_probes() -> Result<i32, anyhow::Error> {
let probes = Probe::list_all();

fn print_probes(probes: Vec<DebugProbeInfo>) -> Result<i32, anyhow::Error> {
if !probes.is_empty() {
println!("The following devices were found:");
probes
Expand Down