Skip to content

Add shell completions generation (bash, zsh, fish) #117

@thomasnemer

Description

@thomasnemer

Problem

No shell completions are provided. Users must type full command and argument names without tab-completion assistance.

Suggested Fix

clap supports built-in shell completion generation via the clap_complete crate. Add a hidden syld completions <shell> subcommand that outputs completion scripts:

use clap_complete::{generate, Shell};

#[derive(Subcommand)]
enum Commands {
    /// Generate shell completions
    #[command(hide = true)]
    Completions {
        #[arg(value_enum)]
        shell: Shell,
    },
}

Then document usage in README:

# Bash
syld completions bash > ~/.local/share/bash-completion/completions/syld

# Zsh
syld completions zsh > ~/.local/share/zsh/site-functions/_syld

# Fish
syld completions fish > ~/.config/fish/completions/syld.fish

Priority

Low — quality-of-life improvement for power users

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions