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

Globbing is broken when building from source #26

Open
iftheshoefritz opened this issue Dec 13, 2024 · 2 comments
Open

Globbing is broken when building from source #26

iftheshoefritz opened this issue Dec 13, 2024 · 2 comments

Comments

@iftheshoefritz
Copy link

iftheshoefritz commented Dec 13, 2024

Compare 7a4d6cf (just before the switch to clap) [globbing works]:

☁  complexity [7a4d6cf] cargo run -- --only src/**/*.rs
   Compiling complexity v0.4.2 (/Users/frederickmeissner/devprojects/complexity)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.31s
     Running `target/debug/complexity --only src/cli.rs src/configuration.rs src/files_filter.rs src/flags.rs src/lib.rs src/main.rs src/parsed_file.rs src/parser.rs src/scoring.rs src/scoring/length.rs src/scoring/standard.rs`
   16.55 ./src/cli.rs
    8.56 ./src/parser.rs
    0.67 ./src/main.rs
    6.17 ./src/scoring/length.rs
    6.78 ./src/scoring/standard.rs
    5.63 ./src/parsed_file.rs
   14.82 ./src/files_filter.rs
    5.06 ./src/configuration.rs
    0.11 ./src/lib.rs
   16.44 ./src/scoring.rs
    5.72 ./src/flags.rs

With ad3b (switch to clap) and later [globbing is broken]:

☁  complexity [ad3bf6a] cargo run -- --only **/*.rs
   Compiling complexity v0.4.2 (/Users/frederickmeissner/devprojects/complexity)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.64s
     Running `target/debug/complexity --only src/cli.rs src/configuration.rs src/files_filter.rs src/flags.rs src/lib.rs src/main.rs src/parsed_file.rs src/parser.rs src/scoring.rs src/scoring/length.rs src/scoring/standard.rs`
error: The subcommand 'src/configuration.rs' wasn't recognized

Usage: complexity [OPTIONS] [COMMAND]

For more information try '--help'

Happily the older commit is what homebrew installs by default, but I assume that there are reasons why we do want to use clap and it would be better to fix our use of clap rather than revert something else useful.

@iftheshoefritz
Copy link
Author

It may be that globbing only worked by accident with structopt, but it would be cool to have, personally I use --only app/**/*.rb for analysing Rails apps a lot.

@neilvcarvalho
Copy link
Member

I managed to mimic the structopt accidental behavior by allowing multiple arguments and setting ',' as a delimiter:

#[clap(long, num_args = 1.., value_delimiter = ',')]

Things get weird if you try something that can't be expanded, like:

complexity --only *.js,*.rb

Because you expect both globbing and comma-separated values to work.

I wonder if a separate flag would be a better fit for supporting multiple full paths like shell expansion would provide.

@joshuaclayton added some thoughts here: #24 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants