Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI #134

Closed
ilslv opened this issue Sep 30, 2021 · 2 comments
Closed

CLI #134

ilslv opened this issue Sep 30, 2021 · 2 comments
Assignees
Labels
enhancement Improvement of existing features or bugfix
Milestone

Comments

@ilslv
Copy link
Member

ilslv commented Sep 30, 2021

In v0.10.0 CLI was preserved as is with error messages for unsupported options. But we want to rework it for more flexibility. Based on Java and JS I've came up with new CLI design:

$ cargo test -- --help
cucumber 0.11.0
Brendan Molloy <[email protected]>,
Ilya Solovyiov <[email protected]>,
Kai Ren <[email protected]>

USAGE:
    cargo test -- [FLAGS] [OPTIONS]

FLAGS:
    -h, --help       Prints this message
    -v               Sets the level of verbosity
    -V, --version    Prints version information

OPTIONS:
    -c, --colors                 <auto/enable/disable>    Indicates, whether output should be colored or not. Default: auto     
    -f, --feature                <FILES>                  Comma separated paths to feature files. Example: path/*/example.feature, other/to/
    -n, --name, --scenario-name  <REGEX>                  Filters scenarios based on name.
    -t, --tags, --scenario-tags  <TAGEXPR>                Filters scenarios based on tag expression. Example: @smoke and not @slow
    --concurrent                 <INT>                    Number of concurrent scenarios.
    --fail_fast                  <BOOL>                   Abort the run on first failure. Default: false

Cucumber tag expressions reference

@ilslv ilslv added the enhancement Improvement of existing features or bugfix label Sep 30, 2021
@ilslv ilslv added this to the 0.11 milestone Sep 30, 2021
@ilslv ilslv self-assigned this Sep 30, 2021
@ilslv ilslv mentioned this issue Oct 4, 2021
15 tasks
@ilslv
Copy link
Member Author

ilslv commented Oct 12, 2021

Also we should consider enabling or disabling some cli options based on specific Parser, Runner or Writer impls. Related to #56 (comment) #140

@ilslv
Copy link
Member Author

ilslv commented Oct 19, 2021

Discussed:

We want then every swappable part (like Parser, Runner and Writer) to have it's own strongly-typed set CLI arguments. This can be done by using #[clap(flatten)] with a generic clap::Arg provider. The only problem is that at the time clap derive-macros doesn't support generic arguments

But structopt recently have added basic implementation of this feature:

So the plan is to try jumping back to latest stable version of the clap and use structopt for strong-typing. If that doesn't work out, we'll have to use some custom trait with dynamic adding/extracting from clap::App.

Long term goal is still to use only clap crate with it's own derive-macros.

@tyranron tyranron modified the milestones: 0.11, 0.10 Oct 21, 2021
tyranron added a commit that referenced this issue Oct 25, 2021
- make CLI options  composable by adding `Cli` associated type to `Parser`, `Runner` and `Writer` traits
- switch to `structopt` crate as `clap` doesn't support generic flattening at the moment
- allow extend `cli::Opts` with a custom `StructOpt` deriver

Additionally:
- fix accidenatlly messed up imports style

Co-authored-by: tyranron <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement of existing features or bugfix
Projects
None yet
Development

No branches or pull requests

2 participants