parent
34155fc36f
commit
3cc5d8df7f
|
@ -24,14 +24,17 @@ fn parse_settings(matches: &ArgMatches<'_>) -> Result<bool, Box<dyn error::Error
|
||||||
println_name_value("* keypair:", &config.keypair);
|
println_name_value("* keypair:", &config.keypair);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
println!("{} Either provide the `--config` arg or ensure home directory exists to use the default config location", style("No config file found.").bold());
|
println!(
|
||||||
|
"{} Either provide the `--config` arg or ensure home directory exists to use the default config location",
|
||||||
|
style("No config file found.").bold()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
("set", Some(subcommand_matches)) => {
|
("set", Some(subcommand_matches)) => {
|
||||||
if let Some(config_file) = matches.value_of("config_file") {
|
if let Some(config_file) = matches.value_of("config_file") {
|
||||||
let mut config = Config::load(config_file).unwrap_or_default();
|
let mut config = Config::load(config_file).unwrap_or_default();
|
||||||
if let Some(url) = subcommand_matches.value_of("url") {
|
if let Some(url) = subcommand_matches.value_of("json_rpc_url") {
|
||||||
config.url = url.to_string();
|
config.url = url.to_string();
|
||||||
}
|
}
|
||||||
if let Some(keypair) = subcommand_matches.value_of("keypair") {
|
if let Some(keypair) = subcommand_matches.value_of("keypair") {
|
||||||
|
@ -42,7 +45,10 @@ fn parse_settings(matches: &ArgMatches<'_>) -> Result<bool, Box<dyn error::Error
|
||||||
println_name_value("* url:", &config.url);
|
println_name_value("* url:", &config.url);
|
||||||
println_name_value("* keypair:", &config.keypair);
|
println_name_value("* keypair:", &config.keypair);
|
||||||
} else {
|
} else {
|
||||||
println!("{} Either provide the `--config` arg or ensure home directory exists to use the default config location", style("No config file found.").bold());
|
println!(
|
||||||
|
"{} Either provide the `--config` arg or ensure home directory exists to use the default config location",
|
||||||
|
style("No config file found.").bold()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
@ -116,10 +122,11 @@ fn main() -> Result<(), Box<dyn error::Error>> {
|
||||||
let matches = app(crate_name!(), crate_description!(), crate_version!())
|
let matches = app(crate_name!(), crate_description!(), crate_version!())
|
||||||
.arg({
|
.arg({
|
||||||
let arg = Arg::with_name("config_file")
|
let arg = Arg::with_name("config_file")
|
||||||
.short("c")
|
.short("C")
|
||||||
.long("config")
|
.long("config")
|
||||||
.value_name("PATH")
|
.value_name("PATH")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
|
.global(true)
|
||||||
.help("Configuration file to use");
|
.help("Configuration file to use");
|
||||||
if let Some(ref config_file) = *config::CONFIG_FILE {
|
if let Some(ref config_file) = *config::CONFIG_FILE {
|
||||||
arg.default_value(&config_file)
|
arg.default_value(&config_file)
|
||||||
|
@ -133,6 +140,7 @@ fn main() -> Result<(), Box<dyn error::Error>> {
|
||||||
.long("url")
|
.long("url")
|
||||||
.value_name("URL")
|
.value_name("URL")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
|
.global(true)
|
||||||
.validator(is_url)
|
.validator(is_url)
|
||||||
.help("JSON RPC URL for the solana cluster"),
|
.help("JSON RPC URL for the solana cluster"),
|
||||||
)
|
)
|
||||||
|
@ -141,6 +149,7 @@ fn main() -> Result<(), Box<dyn error::Error>> {
|
||||||
.short("k")
|
.short("k")
|
||||||
.long("keypair")
|
.long("keypair")
|
||||||
.value_name("PATH")
|
.value_name("PATH")
|
||||||
|
.global(true)
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.help("/path/to/id.json"),
|
.help("/path/to/id.json"),
|
||||||
)
|
)
|
||||||
|
@ -159,26 +168,9 @@ fn main() -> Result<(), Box<dyn error::Error>> {
|
||||||
.subcommand(
|
.subcommand(
|
||||||
SubCommand::with_name("set")
|
SubCommand::with_name("set")
|
||||||
.about("Set a wallet config setting")
|
.about("Set a wallet config setting")
|
||||||
.arg(
|
|
||||||
Arg::with_name("url")
|
|
||||||
.short("u")
|
|
||||||
.long("url")
|
|
||||||
.value_name("URL")
|
|
||||||
.takes_value(true)
|
|
||||||
.validator(is_url)
|
|
||||||
.help("Set default JSON RPC URL to query"),
|
|
||||||
)
|
|
||||||
.arg(
|
|
||||||
Arg::with_name("keypair")
|
|
||||||
.short("k")
|
|
||||||
.long("keypair")
|
|
||||||
.value_name("PATH")
|
|
||||||
.takes_value(true)
|
|
||||||
.help("/path/to/id.json"),
|
|
||||||
)
|
|
||||||
.group(
|
.group(
|
||||||
ArgGroup::with_name("config_settings")
|
ArgGroup::with_name("config_settings")
|
||||||
.args(&["url", "keypair"])
|
.args(&["json_rpc_url", "keypair"])
|
||||||
.multiple(true)
|
.multiple(true)
|
||||||
.required(true),
|
.required(true),
|
||||||
),
|
),
|
||||||
|
|
|
@ -1683,22 +1683,21 @@ pub fn app<'ab, 'v>(name: &str, about: &'ab str, version: &'v str) -> App<'ab, '
|
||||||
.subcommand(
|
.subcommand(
|
||||||
SubCommand::with_name("airdrop")
|
SubCommand::with_name("airdrop")
|
||||||
.about("Request lamports")
|
.about("Request lamports")
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("drone_host")
|
Arg::with_name("drone_host")
|
||||||
.long("drone-host")
|
.long("drone-host")
|
||||||
.value_name("HOST")
|
.value_name("HOST")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.help("Drone host to use [default: the --url host]"),
|
.help("Drone host to use [default: the --url host]"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("drone_port")
|
Arg::with_name("drone_port")
|
||||||
.long("drone-port")
|
.long("drone-port")
|
||||||
.value_name("PORT")
|
.value_name("PORT")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.default_value(solana_drone::drone::DRONE_PORT_STR)
|
.default_value(solana_drone::drone::DRONE_PORT_STR)
|
||||||
.help("Drone port to use"),
|
.help("Drone port to use"),
|
||||||
)
|
)
|
||||||
|
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("lamports")
|
Arg::with_name("lamports")
|
||||||
.index(1)
|
.index(1)
|
||||||
|
@ -1832,7 +1831,7 @@ pub fn app<'ab, 'v>(name: &str, about: &'ab str, version: &'v str) -> App<'ab, '
|
||||||
.value_name("FILE")
|
.value_name("FILE")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.help("Write the account data to this file"),
|
.help("Write the account data to this file"),
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
.subcommand(
|
.subcommand(
|
||||||
SubCommand::with_name("show-vote-account")
|
SubCommand::with_name("show-vote-account")
|
||||||
|
@ -1845,7 +1844,7 @@ pub fn app<'ab, 'v>(name: &str, about: &'ab str, version: &'v str) -> App<'ab, '
|
||||||
.required(true)
|
.required(true)
|
||||||
.validator(is_pubkey_or_keypair)
|
.validator(is_pubkey_or_keypair)
|
||||||
.help("Vote account pubkey"),
|
.help("Vote account pubkey"),
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
.subcommand(
|
.subcommand(
|
||||||
SubCommand::with_name("delegate-stake")
|
SubCommand::with_name("delegate-stake")
|
||||||
|
@ -2045,14 +2044,13 @@ pub fn app<'ab, 'v>(name: &str, about: &'ab str, version: &'v str) -> App<'ab, '
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("storage_account_pubkey")
|
Arg::with_name("storage_account_pubkey")
|
||||||
.index(3)
|
.index(2)
|
||||||
.value_name("STORAGE ACCOUNT PUBKEY")
|
.value_name("STORAGE ACCOUNT PUBKEY")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.required(true)
|
.required(true)
|
||||||
.validator(is_pubkey_or_keypair)
|
.validator(is_pubkey_or_keypair)
|
||||||
.help("Storage account address to redeem credits for"),
|
.help("Storage account address to redeem credits for"),
|
||||||
))
|
))
|
||||||
|
|
||||||
.subcommand(
|
.subcommand(
|
||||||
SubCommand::with_name("show-storage-account")
|
SubCommand::with_name("show-storage-account")
|
||||||
.about("Show the contents of a storage account")
|
.about("Show the contents of a storage account")
|
||||||
|
@ -2166,7 +2164,7 @@ pub fn app<'ab, 'v>(name: &str, about: &'ab str, version: &'v str) -> App<'ab, '
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.default_value("10")
|
.default_value("10")
|
||||||
.help("Wait up to timeout seconds for transaction confirmation"),
|
.help("Wait up to timeout seconds for transaction confirmation"),
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
.subcommand(
|
.subcommand(
|
||||||
SubCommand::with_name("send-signature")
|
SubCommand::with_name("send-signature")
|
||||||
|
|
Loading…
Reference in New Issue