Reputation: 81
Currently I'm trying to write a build.rs
that creates a bunch of autocompletion scripts for a cli app.
// build.rs
fn main() {
let outdir = match std::env::var_os("OUT_DIR") {
None => return,
Some(outdir) => outdir,
};
Args::clap().gen_completions("monk", structopt::clap::Shell::Bash, outdir.clone());
...
}
Currently this outputs the autocomplete scripts in ./target/debug/build/monk-cli-43148fdfeeafb947/out/monk.bash
. I would like to package these scripts in a CICD pipeline, but the path to the scripts is inconsistent. Is there a way that I could have these files output to a consistent directory like ./target/completions/monk.bash
, or should I be doing this autocomplete script generation somewhere other than build.rs?
Upvotes: 3
Views: 2797