include! macro is what we were missing
vitiral opened this issue · comments
If we use include!
we could remove the sub-crate pretty trivially:
https://blog.clap.rs/complete-me/#completionscriptgenerationinclap
// build.rs
extern crate clap;
use clap::Shell;
include!("src/cli.rs");
fn main() {
let mut app = build_cli();
app.gen_completions("fake", // We specify the bin name manually
Shell::Bash, // Which shell to build completions for
env!("OUT_DIR")); // Where write the completions to
}
Basically the functions that we need can just be defined in files and then we can manaully include them for the build script -- removing the need of a sub-crate.