Fixes minor cli issues
This commit is contained in:
parent
f30b632ff7
commit
f1dee1d115
|
@ -158,7 +158,7 @@ impl Application for ZebradApp {
|
|||
// Automatically use color if we're outputting to a terminal
|
||||
//
|
||||
// The `abcissa` docs claim that abscissa implements `Auto`, but it
|
||||
// does not - except in `color_backtrace` backtraces.
|
||||
// does not.
|
||||
// let mut term_colors = self.term_colors(command);
|
||||
// if term_colors == ColorChoice::Auto {
|
||||
// // We want to disable colors on a per-stream basis, but that feature
|
||||
|
@ -175,6 +175,10 @@ impl Application for ZebradApp {
|
|||
|
||||
// The Tracing component uses stdout directly and will apply colors
|
||||
// `if Self::outputs_are_ttys() && config.tracing.use_colors`
|
||||
//
|
||||
// Note: It's important to use `ColorChoice::Never` here to avoid panicking in
|
||||
// `register_components()` below if `color_eyre::install()` is called
|
||||
// after `color_spantrace` has been initialized.
|
||||
let terminal = Terminal::new(ColorChoice::Never);
|
||||
|
||||
Ok(vec![Box::new(terminal)])
|
||||
|
@ -489,7 +493,7 @@ pub fn boot(app_cell: &'static AppCell<ZebradApp>) -> ! {
|
|||
// update last_top_level_arg_idx to the number of top-level args
|
||||
for (idx, arg) in args.iter().enumerate() {
|
||||
num_top_level_args = match arg.to_str() {
|
||||
Some("--verbose" | "-v") => idx + 1,
|
||||
Some("--verbose" | "-v" | "--version" | "--help") => idx + 1,
|
||||
Some("--config" | "-c") => idx + 2,
|
||||
_ => num_top_level_args,
|
||||
}
|
||||
|
|
|
@ -123,10 +123,14 @@ impl Configurable<ZebradConfig> for ZebradCmd {
|
|||
}
|
||||
}
|
||||
|
||||
/// Toplevel entrypoint command.
|
||||
/// zebrad 1.0.0-rc.8
|
||||
///
|
||||
/// Handles obtaining toplevel help as well as verbosity settings.
|
||||
/// Zcash Foundation <zebra@zfnd.org>
|
||||
// Toplevel entrypoint command.
|
||||
//
|
||||
// Handles obtaining toplevel help as well as verbosity settings.
|
||||
#[derive(Debug, clap::Parser)]
|
||||
#[clap(version = clap::crate_version!())]
|
||||
pub struct EntryPoint {
|
||||
/// Subcommand to execute.
|
||||
///
|
||||
|
|
|
@ -60,7 +60,7 @@ const PROGRESS_HEIGHT_INTERVAL: u32 = 5_000;
|
|||
#[derive(Command, Debug, clap::Parser)]
|
||||
pub struct CopyStateCmd {
|
||||
/// Source height that the copy finishes at.
|
||||
#[clap(long, help = "stop copying at this source height")]
|
||||
#[clap(long, short, help = "stop copying at this source height")]
|
||||
max_source_height: Option<u32>,
|
||||
|
||||
/// Path to a Zebra config.toml for the target state.
|
||||
|
@ -70,13 +70,14 @@ pub struct CopyStateCmd {
|
|||
/// All other options are ignored.
|
||||
#[clap(
|
||||
long,
|
||||
short,
|
||||
help = "config file path for the target state (default: ephemeral), \
|
||||
the source state uses the main zebrad config"
|
||||
)]
|
||||
target_config_path: Option<PathBuf>,
|
||||
|
||||
/// Filter strings which override the config file and defaults
|
||||
#[clap(long, help = "tracing filters which override the zebrad.toml config")]
|
||||
#[clap(help = "tracing filters which override the zebrad.toml config")]
|
||||
filters: Vec<String>,
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ pub struct GenerateCmd {
|
|||
/// The file to write the generated config to.
|
||||
#[clap(
|
||||
long,
|
||||
short,
|
||||
help = "The file to write the generated config to (stdout if unspecified)"
|
||||
)]
|
||||
output_file: Option<String>,
|
||||
|
|
|
@ -23,11 +23,11 @@ use crate::prelude::APPLICATION;
|
|||
#[derive(Command, Debug, Default, Parser)]
|
||||
pub struct TipHeightCmd {
|
||||
/// Path to Zebra's cached state.
|
||||
#[clap(long, help = "path to directory with the Zebra chain state")]
|
||||
#[clap(long, short, help = "path to directory with the Zebra chain state")]
|
||||
cache_dir: Option<PathBuf>,
|
||||
|
||||
/// The network to obtain the chain tip.
|
||||
#[clap(long, help = "the network of the chain to load")]
|
||||
#[clap(long, short, help = "the network of the chain to load")]
|
||||
network: Network,
|
||||
}
|
||||
|
||||
|
|
|
@ -264,11 +264,11 @@ fn help_no_args() -> Result<()> {
|
|||
is_zebrad_version,
|
||||
&output.output.stdout,
|
||||
"stdout",
|
||||
"a valid zebrad semantic version",
|
||||
"with a valid zebrad semantic version",
|
||||
)?;
|
||||
|
||||
// Make sure we are in help by looking usage string
|
||||
output.stdout_line_contains("USAGE:")?;
|
||||
output.stdout_line_contains("Usage:")?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -522,7 +522,7 @@ fn version_no_args() -> Result<()> {
|
|||
|
||||
let testdir = testdir()?.with_config(&mut default_test_config()?)?;
|
||||
|
||||
let child = testdir.spawn_child(args!["version"])?;
|
||||
let child = testdir.spawn_child(args!["--version"])?;
|
||||
let output = child.wait_with_output()?;
|
||||
let output = output.assert_success()?;
|
||||
|
||||
|
@ -545,12 +545,12 @@ fn version_args() -> Result<()> {
|
|||
let testdir = &testdir;
|
||||
|
||||
// unexpected free argument `argument`
|
||||
let child = testdir.spawn_child(args!["version", "argument"])?;
|
||||
let child = testdir.spawn_child(args!["--version", "argument"])?;
|
||||
let output = child.wait_with_output()?;
|
||||
output.assert_failure()?;
|
||||
|
||||
// unrecognized option `-f`
|
||||
let child = testdir.spawn_child(args!["version", "-f"])?;
|
||||
let child = testdir.spawn_child(args!["--version", "-f"])?;
|
||||
let output = child.wait_with_output()?;
|
||||
output.assert_failure()?;
|
||||
|
||||
|
|
Loading…
Reference in New Issue