Skip to content

Commit

Permalink
Revert "Consider config in check_for_usb (solana-labs#9555)"
Browse files Browse the repository at this point in the history
This reverts commit a9c38fb.
  • Loading branch information
CriesofCarrots committed Apr 18, 2020
1 parent a7aa7e1 commit 6de5a78
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 20 deletions.
20 changes: 6 additions & 14 deletions cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use solana_cli_config::{Config, CONFIG_FILE};
use solana_remote_wallet::remote_wallet::{maybe_wallet_manager, RemoteWalletManager};
use std::{error, sync::Arc};

fn parse_settings(matches: &ArgMatches<'_>) -> Result<Option<bool>, Box<dyn error::Error>> {
fn parse_settings(matches: &ArgMatches<'_>) -> Result<bool, Box<dyn error::Error>> {
let parse_args = match matches.subcommand() {
("config", Some(matches)) => match matches.subcommand() {
("get", Some(subcommand_matches)) => {
Expand Down Expand Up @@ -54,7 +54,7 @@ fn parse_settings(matches: &ArgMatches<'_>) -> Result<Option<bool>, Box<dyn erro
style("No config file found.").bold()
);
}
None
false
}
("set", Some(subcommand_matches)) => {
if let Some(config_file) = matches.value_of("config_file") {
Expand Down Expand Up @@ -94,19 +94,11 @@ fn parse_settings(matches: &ArgMatches<'_>) -> Result<Option<bool>, Box<dyn erro
style("No config file found.").bold()
);
}
None
false
}
_ => unreachable!(),
},
_ => {
let need_wallet_manager = if let Some(config_file) = matches.value_of("config_file") {
let config = Config::load(config_file).unwrap_or_default();
check_for_usb([config.keypair_path].iter())
} else {
false
};
Some(need_wallet_manager)
}
_ => true,
};
Ok(parse_args)
}
Expand Down Expand Up @@ -270,8 +262,8 @@ fn do_main(
matches: &ArgMatches<'_>,
need_wallet_manager: bool,
) -> Result<(), Box<dyn error::Error>> {
if let Some(config_need_wallet_manager) = parse_settings(&matches)? {
let wallet_manager = if need_wallet_manager || config_need_wallet_manager {
if parse_settings(&matches)? {
let wallet_manager = if need_wallet_manager {
maybe_wallet_manager()?
} else {
None
Expand Down
11 changes: 5 additions & 6 deletions keygen/src/keygen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,12 +407,11 @@ fn do_main(matches: &ArgMatches<'_>) -> Result<(), Box<dyn error::Error>> {
Config::default()
};

let wallet_manager =
if check_for_usb(std::env::args()) || check_for_usb([config.keypair_path.clone()].iter()) {
maybe_wallet_manager()?
} else {
None
};
let wallet_manager = if check_for_usb(std::env::args()) {
maybe_wallet_manager()?
} else {
None
};

match matches.subcommand() {
("pubkey", Some(matches)) => {
Expand Down

0 comments on commit 6de5a78

Please sign in to comment.