Files
s390-tools/rust/pvattest/build.rs
Marc Hartmayer f83af8e076 rust: Generate shell (e.g. bash) completion scripts via build.rs for all tools
It might be handy to have shell completion support for the Rust PV
tools.

Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2024-05-27 16:54:25 +02:00

26 lines
711 B
Rust

// SPDX-License-Identifier: MIT
//
// Copyright IBM Corp. 2024
// it under the terms of the MIT license. See LICENSE for details.
use clap::CommandFactory;
use clap_complete::{generate_to, Shell};
use std::env;
use std::io::Error;
include!("src/cli.rs");
fn main() -> Result<(), Error> {
let outdir = env::var_os("OUT_DIR").unwrap();
let crate_name = env!("CARGO_PKG_NAME");
let mut cmd = CliOptions::command();
for &shell in Shell::value_variants() {
generate_to(shell, &mut cmd, crate_name, &outdir)?;
}
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed=src/cli.rs");
println!("cargo:rerun-if-changed=../utils/src/cli.rs");
Ok(())
}