Skip to content

Commit

Permalink
[cargo-nextest] group cargo options and ensure everything is printed …
Browse files Browse the repository at this point in the history
…on one line
  • Loading branch information
sunshowers committed Jan 25, 2022
1 parent 46d5a29 commit 489c2c0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
13 changes: 7 additions & 6 deletions nextest/cargo-nextest/src/cargo_cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
use crate::output::OutputContext;
use camino::Utf8PathBuf;
use clap::Args;
use clap::{AppSettings, Args};
use std::path::PathBuf;

/// Options passed down to cargo.
#[derive(Debug, Args)]
#[clap(help_heading = "CARGO OPTIONS", setting = AppSettings::DeriveDisplayOrder)]
pub(crate) struct CargoOptions {
/// Test only this package's library unit tests
#[clap(long)]
Expand Down Expand Up @@ -67,11 +68,11 @@ pub(crate) struct CargoOptions {
release: bool,

/// Build artifacts with the specified Cargo profile
#[clap(long)]
#[clap(long, value_name = "NAME")]
cargo_profile: Option<String>,

/// Number of build jobs to run
#[clap(long)]
#[clap(long, value_name = "JOBS")]
build_jobs: Option<String>,

/// Space or comma separated list of features to activate
Expand All @@ -87,11 +88,11 @@ pub(crate) struct CargoOptions {
no_default_features: bool,

/// Build for the target triple
#[clap(long)]
#[clap(long, value_name = "TRIPLE")]
target: Option<String>,

/// Directory for all generated artifacts
#[clap(long)]
#[clap(long, value_name = "DIR")]
target_dir: Option<String>,

/// Ignore `rust-version` specification in packages
Expand Down Expand Up @@ -121,7 +122,7 @@ pub(crate) struct CargoOptions {
offline: bool,

/// Override a configuration value (unstable)
#[clap(long)]
#[clap(long, value_name = "KEY=VALUE")]
config: Vec<String>,
}

Expand Down
14 changes: 8 additions & 6 deletions nextest/cargo-nextest/src/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ use nextest_runner::{
use std::io::Cursor;
use supports_color::Stream;

/// This test runner accepts a Rust test binary and does fancy things with it.
/// Next-generation test runner for Rust.
///
/// TODO: expand on this
#[derive(Debug, Parser)]
#[clap(rename_all = "kebab-case")]
#[clap(author, version)]
pub struct CargoNextestApp {
/// Path to Cargo.toml
#[clap(long, global = true, value_name = "PATH")]
Expand Down Expand Up @@ -94,7 +94,7 @@ pub struct TestBuildFilter {
cargo_options: CargoOptions,

/// Run ignored tests
#[clap(long, possible_values = RunIgnored::variants(), default_value_t)]
#[clap(long, possible_values = RunIgnored::variants(), default_value_t, value_name = "WHICH")]
run_ignored: RunIgnored,

/// Test partition, e.g. hash:1/2 or count:2/3
Expand Down Expand Up @@ -189,21 +189,23 @@ pub struct TestReporterOpts {
#[clap(
long,
possible_values = TestOutputDisplay::variants(),
conflicts_with = "no-capture"
conflicts_with = "no-capture",
value_name = "WHEN"
)]
failure_output: Option<TestOutputDisplay>,
/// Output stdout and stderr on success
#[clap(
long,
possible_values = TestOutputDisplay::variants(),
conflicts_with = "no-capture"
conflicts_with = "no-capture",
value_name = "WHEN"
)]
success_output: Option<TestOutputDisplay>,

// status_level does not conflict with --no-capture because pass vs skip still makes sense.
/// Test statuses to output
#[clap(long, possible_values = StatusLevel::variants())]
#[clap(long, possible_values = StatusLevel::variants(), value_name = "LEVEL")]
status_level: Option<StatusLevel>,
}

Expand Down
3 changes: 2 additions & 1 deletion nextest/cargo-nextest/src/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ pub(crate) struct OutputOpts {
arg_enum,
default_value_t,
hide_possible_values = true,
global = true
global = true,
value_name = "WHEN"
)]
pub(crate) color: Color,
}
Expand Down

0 comments on commit 489c2c0

Please sign in to comment.