click icon indicating copy to clipboard operation
click copied to clipboard

Add support for partial shell completion options like in Path

Open maltevesper opened this issue 1 month ago • 3 comments

When tab completing a path on the shell, the options only display a part and ommit the prefix path, making it much easier to read. I.e. completing "/home/user" will offer

Documents Downloads Pictures

rather than

/home/user/Documents /home/user/Downloads /home/user/Pictures

While click already supports this for paths, it would be nice if a similar feature would be implemented for custom parameters (i.e. comma separated values).

maltevesper avatar Nov 04 '25 10:11 maltevesper

Hi, I'd like to try implementing this feature. Can I be assigned to this issue?

learncold avatar Nov 04 '25 13:11 learncold

It's the shell (bash, zsh, fish, etc) itself that is handling how to show completions. Click sends a special signal to the completer script that it's a file path, and the shell does the rest. Otherwise, the only thing we can send to the shell is the full completion value.

I don't think there's anything to do here on the Click level. There may be an option in a specific shell's completion system. However, it's already possible to write your own completer to use your personal preference in that case.

davidism avatar Nov 04 '25 16:11 davidism

Reopening to add info for docs. Need an FAQ. A fair amount of requests seem to not know what is done by click vs shell.

Rowlando13 avatar Nov 08 '25 04:11 Rowlando13