generate_completion_for_command

Function generate_completion_for_command 

Source
pub fn generate_completion_for_command<G: Generator>(
    generator: G,
    cmd: &mut Command,
) -> Result<(), String>
Expand description

Generate shell completion script to stdout for a given command.

Generates shell-specific completion scripts that enable tab completion for HEDL CLI commands, arguments, and file paths.

§Arguments

  • generator - The shell generator (Bash, Zsh, Fish, PowerShell, or Elvish)
  • cmd - The clap Command to generate completions for

§Returns

Returns Ok(()) on success.

§Errors

This function does not typically return errors, but uses Result for consistency with other command functions.

§Examples

use clap::Command;
use clap_complete::shells::Bash;
use hedl_cli::commands::generate_completion_for_command;

let mut cmd = Command::new("hedl");
generate_completion_for_command(Bash, &mut cmd)?;

§Output

Writes the completion script to stdout. Users typically redirect this to a file or evaluate it in their shell configuration.