Struct cucumber::cli::Opts

source ·
pub struct Opts<Parser, Runner, Writer, Custom = Empty>where
    Parser: Args,
    Runner: Args,
    Writer: Args,
    Custom: Args,
{ pub re_filter: Option<Regex>, pub tags_filter: Option<TagOperation>, pub parser: Parser, pub runner: Runner, pub writer: Writer, pub custom: Custom, }
Expand description

Root CLI (command line interface) of a top-level Cucumber executor.

It combines all the nested CLIs of Parser, Runner and Writer, and may be extended with custom CLI options additionally.

Example

#[derive(clap::Args)] // also re-exported as `cli::Args`
struct CustomOpts {
    /// Additional time to wait in before hook.
    #[arg(
        long,
        value_parser = humantime::parse_duration,
    )]
    pre_pause: Option<Duration>,
}

let opts = cli::Opts::<_, _, _, CustomOpts>::parsed();
let pre_pause = opts.custom.pre_pause.unwrap_or_default();

MyWorld::cucumber()
    .before(move |_, _, _, _| time::sleep(pre_pause).boxed_local())
    .with_cli(opts)
    .run_and_exit("tests/features/readme")
    .await;

Fields§

§re_filter: Option<Regex>

Regex to filter scenarios by their name.

§tags_filter: Option<TagOperation>

Tag expression to filter scenarios by.

Note: Tags from Feature, Rule and Scenario are merged together on filtering, so be careful about conflicting tags on different levels.

§parser: Parser

Parser CLI options.

§runner: Runner

Runner CLI options.

§writer: Writer

Writer CLI options.

§custom: Custom

Additional custom CLI options.

Implementations§

Shortcut for clap::Parser::parse(), which doesn’t require the trait being imported.

Trait Implementations§

Report the ArgGroup::id for this set of arguments
Append to Command so it can instantiate Self. Read more
Append to Command so it can update self. Read more
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Build a Command that can instantiate Self. Read more
Build a Command that can update self. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Assign values from ArgMatches to self.
Assign values from ArgMatches to self.
Parse from std::env::args_os(), exit on error
Parse from std::env::args_os(), return Err on error.
Parse from iterator, exit on error
Parse from iterator, return Err on error.
Update from iterator, exit on error
Update from iterator, return Err on error.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Asserts this Writer being Normalized. Read more
Wraps this Writer into a Normalized version. Read more
Wraps this Writer to print a summary at the end of an output. Read more
Wraps this Writer to fail on Skipped Steps if their Scenario isn’t marked with @allow.skipped tag. Read more
Wraps this Writer to fail on Skipped Steps if the given with predicate returns true. Read more
Wraps this Writer to re-output Skipped Steps at the end of an output.
Wraps this Writer to re-output Failed Steps or Parser errors at the end of an output.
Wraps this Writer to re-output filtered events at the end of an output.
Attaches the provided other Writer to the current one for passing events to both of them simultaneously.
Wraps this Writer into a discard::Arbitrary one, providing a no-op ArbitraryWriter implementation. Read more
Wraps this Writer into a discard::Stats one, providing a no-op StatsWriter implementation returning only 0. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.