diff --git a/zebrad/src/application.rs b/zebrad/src/application.rs index 2dbd024d1..4a295c85f 100644 --- a/zebrad/src/application.rs +++ b/zebrad/src/application.rs @@ -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) -> ! { // 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, } diff --git a/zebrad/src/commands.rs b/zebrad/src/commands.rs index e59cd0d40..e7045a4e3 100644 --- a/zebrad/src/commands.rs +++ b/zebrad/src/commands.rs @@ -123,10 +123,14 @@ impl Configurable for ZebradCmd { } } -/// Toplevel entrypoint command. +/// zebrad 1.0.0-rc.8 /// -/// Handles obtaining toplevel help as well as verbosity settings. +/// Zcash Foundation +// 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. /// diff --git a/zebrad/src/commands/copy_state.rs b/zebrad/src/commands/copy_state.rs index 80f71d065..7ae739691 100644 --- a/zebrad/src/commands/copy_state.rs +++ b/zebrad/src/commands/copy_state.rs @@ -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, /// 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, /// 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, } diff --git a/zebrad/src/commands/generate.rs b/zebrad/src/commands/generate.rs index bab0eedde..6a8d7b0f5 100644 --- a/zebrad/src/commands/generate.rs +++ b/zebrad/src/commands/generate.rs @@ -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, diff --git a/zebrad/src/commands/tip_height.rs b/zebrad/src/commands/tip_height.rs index 894eeb85b..f066d26a1 100644 --- a/zebrad/src/commands/tip_height.rs +++ b/zebrad/src/commands/tip_height.rs @@ -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, /// 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, } diff --git a/zebrad/tests/acceptance.rs b/zebrad/tests/acceptance.rs index 81952672c..63ae1b6f5 100644 --- a/zebrad/tests/acceptance.rs +++ b/zebrad/tests/acceptance.rs @@ -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()?;