Allow multiple --accounts arguments

This commit is contained in:
Michael Vines 2020-12-20 21:36:27 -08:00 committed by mergify[bot]
parent 57b03c5bc1
commit 8082a2454c
1 changed files with 11 additions and 5 deletions

View File

@ -1008,6 +1008,7 @@ pub fn main() {
.long("accounts") .long("accounts")
.value_name("PATHS") .value_name("PATHS")
.takes_value(true) .takes_value(true)
.multiple(true)
.help("Comma separated persistent accounts location"), .help("Comma separated persistent accounts location"),
) )
.arg( .arg(
@ -1529,11 +1530,16 @@ pub fn main() {
solana_net_utils::parse_port_range(matches.value_of("dynamic_port_range").unwrap()) solana_net_utils::parse_port_range(matches.value_of("dynamic_port_range").unwrap())
.expect("invalid dynamic_port_range"); .expect("invalid dynamic_port_range");
let account_paths = if let Some(account_paths) = matches.value_of("account_paths") { let account_paths: Vec<PathBuf> =
account_paths.split(',').map(PathBuf::from).collect() if let Ok(account_paths) = values_t!(matches, "account_paths", String) {
} else { account_paths
vec![ledger_path.join("accounts")] .join(",")
}; .split(',')
.map(PathBuf::from)
.collect()
} else {
vec![ledger_path.join("accounts")]
};
// Create and canonicalize account paths to avoid issues with symlink creation // Create and canonicalize account paths to avoid issues with symlink creation
validator_config.account_paths = account_paths validator_config.account_paths = account_paths