These are chat archives for kbknapp/clap-rs

19th
Mar 2018
Aleksey Kladov
@matklad
Mar 19 2018 06:08 UTC

Hm, I have this weird behavior which I can't quite explain.... I cargo, we use AllowExternalSubcommands. And external subcommands do work as expected, except for the case where external subcommand name is a prefix of a build-in subcommand. That is, cargo fmt works, but cargo install-update fails with

error: The subcommand 'install-update' wasn't recognized
        Did you mean 'install'?

(i.e, it fails when I try to get matches)

Could it be that some form of autocorrect gets kicked-in? It probably shouldn't, with AllowExternalSubcommands....

Aleksey Kladov
@matklad
Mar 19 2018 06:37 UTC
Send a PR: kbknapp/clap-rs#1215 =)
Kevin K.
@kbknapp
Mar 19 2018 15:03 UTC
Ah yes, it tries to match before it knows it's an external command.
About to check out all the PRs :)
(finally haha)
Kevin K.
@kbknapp
Mar 19 2018 18:17 UTC
@matklad v2.31.2 is up on crates.io with the fix
Aleksey Kladov
@matklad
Mar 19 2018 19:06 UTC

Excellent, thanks!

FYI, I've noticed that clap has quite a few integration tests crates. We used a similar setup in Cargo, but it than turned out that it slows down compilation, and inflates the /target size, when running tests, because each test effectively gets its own copy of the library. We've since switched to "one test crate with many submodules" setup, and it is indeed noticeably faster. Some benchmarks are here: https://github.com/rust-lang/cargo/pull/5022#issuecomment-364691154

Note that Cargo is a somewhat extreme case, because it itself is huge, and had a boatload of integration tests :)

Kevin K.
@kbknapp
Mar 19 2018 19:09 UTC
interesting!!
I'll have to do a similar test to see what it does