veks-completion 0.10.1

Dynamic shell completion engine for CLI tools
Documentation

Dynamic shell completion engine for CLI tools.

Provides a generic, tree-based completion system that completes one level at a time (no eager subcommand chaining). The caller defines the command tree via [CommandTree], and this crate handles:

  • Walking the tree to find candidates for a given input
  • Generating bash completion scripts
  • Handling the _<APP>_COMPLETE=bash and COMPLETE=bash env var callbacks

Usage

use veks_completion::{CommandTree, Node, complete, print_bash_script, handle_complete_env};

let tree = CommandTree::new("myapp")
    .command("run", Node::leaf(&["--dry-run", "--threads"]))
    .command("check", Node::leaf(&["--all", "--quiet"]))
    .group("pipeline", Node::group(vec![
        ("compute", Node::group(vec![
            ("knn", Node::leaf(&["--base", "--query", "--metric"])),
        ])),
    ]));

// In main():
if handle_complete_env("myapp", &tree) {
    std::process::exit(0);
}