Sort device paths for select (#8896)
This commit is contained in:
parent
bfca226964
commit
2237f47b90
|
@ -433,13 +433,16 @@ pub fn get_ledger_from_info(
|
||||||
return Err(device.error.clone().unwrap());
|
return Err(device.error.clone().unwrap());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let (pubkeys, device_paths): (Vec<Pubkey>, Vec<String>) = matches
|
let mut matches: Vec<(Pubkey, String)> = matches
|
||||||
.filter(|&device_info| device_info.error.is_none())
|
.filter(|&device_info| device_info.error.is_none())
|
||||||
.map(|device_info| (device_info.pubkey, device_info.get_pretty_path()))
|
.map(|device_info| (device_info.pubkey, device_info.get_pretty_path()))
|
||||||
.unzip();
|
.collect();
|
||||||
if pubkeys.is_empty() {
|
if matches.is_empty() {
|
||||||
return Err(RemoteWalletError::NoDeviceFound);
|
return Err(RemoteWalletError::NoDeviceFound);
|
||||||
}
|
}
|
||||||
|
matches.sort_by(|a, b| a.1.cmp(&b.1));
|
||||||
|
let (pubkeys, device_paths): (Vec<Pubkey>, Vec<String>) = matches.into_iter().unzip();
|
||||||
|
|
||||||
let wallet_base_pubkey = if pubkeys.len() > 1 {
|
let wallet_base_pubkey = if pubkeys.len() > 1 {
|
||||||
let selection = Select::with_theme(&ColorfulTheme::default())
|
let selection = Select::with_theme(&ColorfulTheme::default())
|
||||||
.with_prompt(&format!(
|
.with_prompt(&format!(
|
||||||
|
|
Loading…
Reference in New Issue