Default --ledger arg to "ledger" for `solana-validator` and `solana-ledger-tool`

This commit is contained in:
Michael Vines 2021-03-11 11:14:54 -08:00
parent 1061d021c9
commit aa2b2d6b75
3 changed files with 16 additions and 6 deletions

View File

@ -221,7 +221,8 @@ impl BigTableSubCommand for App<'_, '_> {
self.subcommand(
SubCommand::with_name("bigtable")
.about("Ledger data on a BigTable instance")
.setting(AppSettings::ArgRequiredElseHelp)
.setting(AppSettings::InferSubcommands)
.setting(AppSettings::SubcommandRequiredElseHelp)
.subcommand(
SubCommand::with_name("upload")
.about("Upload the ledger to BigTable")

View File

@ -1,7 +1,7 @@
#![allow(clippy::integer_arithmetic)]
use clap::{
crate_description, crate_name, value_t, value_t_or_exit, values_t_or_exit, App, Arg,
ArgMatches, SubCommand,
crate_description, crate_name, value_t, value_t_or_exit, values_t_or_exit, App, AppSettings,
Arg, ArgMatches, SubCommand,
};
use itertools::Itertools;
use log::*;
@ -811,6 +811,9 @@ fn main() {
let matches = App::new(crate_name!())
.about(crate_description!())
.version(solana_version::version!())
.setting(AppSettings::InferSubcommands)
.setting(AppSettings::SubcommandRequiredElseHelp)
.setting(AppSettings::VersionlessSubcommands)
.arg(
Arg::with_name("ledger_path")
.short("l")
@ -818,7 +821,8 @@ fn main() {
.value_name("DIR")
.takes_value(true)
.global(true)
.help("Use DIR for ledger location"),
.default_value("ledger")
.help("Use DIR as ledger location"),
)
.arg(
Arg::with_name("wal_recovery_mode")
@ -1355,7 +1359,11 @@ fn main() {
// Canonicalize ledger path to avoid issues with symlink creation
let ledger_path = fs::canonicalize(&ledger_path).unwrap_or_else(|err| {
eprintln!("Unable to access ledger path: {:?}", err);
eprintln!(
"Unable to access ledger path '{}': {}",
ledger_path.display(),
err
);
exit(1);
});

View File

@ -1042,7 +1042,8 @@ pub fn main() {
.value_name("DIR")
.takes_value(true)
.required(true)
.help("Use DIR as persistent ledger location"),
.default_value("ledger")
.help("Use DIR as ledger location"),
)
.arg(
Arg::with_name("entrypoint")