You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Probably all but 2.20.3 was the one where the bug was encountered.
Expected Behavior Summary
Build and compilation should succeed.
Actual Behavior Summary
Build fails with the following output:
$ cargo build
Compiling mwe v0.1.0 (file:///D:/GitHub/rust-phpup)
error: failed to run custom build command for `mwe v0.1.0 (file:///D:/GitHub/rust-phpup)`
process didn't exit successfully: `D:\GitHub\rust-phpup\target\debug\build\mwe-563482c66f20550f\build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'Non-unique argument name: quiet is already in use', C:\Users\Fleshgrinder\.cargo\registry\src\github.com-1ecc6299db9ec823\clap-2.20.3\src\app\parser.rs:147
note: Run with `RUST_BACKTRACE=1` for a backtrace.
Also, incase anyone else is running into this calling the gen_completions causes all global Args to be propogated, on second and further iterations of the loop, this causes duplicate Args to be built which is an error.
This is a bug, and those duplicate Args should be ignored in this case.
The temporary fix is to rebuild the App struct with each iteration of the loop (which takes nanoseconds, so isn't a big deal).
for shell in&[Shell::Bash,Shell::PowerShell]{letmut app = build_cli();
app.gen_completions(env!("CARGO_PKG_NAME"),*shell,env!("OUT_DIR"));}
Rust Version
N/A
Affected Version of clap
Probably all but 2.20.3 was the one where the bug was encountered.
Expected Behavior Summary
Build and compilation should succeed.
Actual Behavior Summary
Build fails with the following output:
Steps to Reproduce the issue
cargo build
the code linked in the GistSample Code or Link to Sample Code
https://gist.github.com/Fleshgrinder/3b562bb6c91deb49635543e68f720651
Reason
The problem occurs due to
gen_completion
andbuild.rs
where the app is reused in the loop as you discovered already in a short Gitter chat.The text was updated successfully, but these errors were encountered: