diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-04-14 14:33:24 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-04-14 14:33:24 +0200 |
commit | 8f4f24b31abcf62e6688614b7986534d41de0b00 (patch) | |
tree | 3abbb3c78f206a8c8d12fd304cf3ffb5f94db4a6 /pkgs/by-name/ts/tskm/build.rs | |
parent | pkgs/default.nix: No longer required `sysLib` as input (diff) | |
download | nixos-config-8f4f24b31abcf62e6688614b7986534d41de0b00.zip |
pkgs/tskm: Add completions for dynamic values
This brings `tskm` again on the same level `neorg` was with regard to completions.
Diffstat (limited to '')
-rw-r--r-- | pkgs/by-name/ts/tskm/build.rs | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/pkgs/by-name/ts/tskm/build.rs b/pkgs/by-name/ts/tskm/build.rs deleted file mode 100644 index e3b60bb9..00000000 --- a/pkgs/by-name/ts/tskm/build.rs +++ /dev/null @@ -1,52 +0,0 @@ -use anyhow::{Context, Result}; -use clap::{CommandFactory, ValueEnum}; -use clap_complete::generate_to; -use clap_complete::Shell; - -use std::env; -use std::fs; -use std::path::PathBuf; - -use crate::cli::CliArgs; - -pub mod task { - include!("src/task/mod.rs"); -} -pub mod state { - include!("src/state.rs"); -} - -pub mod interface { - pub mod input { - include!("src/interface/input/mod.rs"); - } - pub mod project { - include!("src/interface/project/mod.rs"); - } -} - -pub mod cli { - include!("src/cli.rs"); -} - -fn main() -> Result<()> { - let outdir = match env::var_os("SHELL_COMPLETION_DIR") { - None => return Ok(()), - Some(outdir) => outdir, - }; - - if !PathBuf::from(&outdir).exists() { - fs::create_dir_all(&outdir)?; - } - - let mut cmd = CliArgs::command(); - - for &shell in Shell::value_variants() { - let path = generate_to(shell, &mut cmd, "tskm", &outdir).with_context(|| { - format!("Failed to output shell completion for {shell} to {outdir:?}") - })?; - println!("cargo:warning=completion file for {shell} is generated at: {path:?}"); - } - - Ok(()) -} |