Auto complete kopia commands in shell

Hi,

One convenient feature could be to the add the auto completion of kopia commands in shell. ex: with bash shell on debian, when typing "sudo apt-get ", a tab key press triggers the available commands. Typing "kopia repository " could list the commands listed in “kopia repository --help”, and “kopia rep” could auto complete the command to “kopia repository”.

Din

1 Like

It is supported in fact, thanks to the library kopia uses to implement command line parsing:

See GitHub - alecthomas/kingpin at v2.2.6

Hi!,

I just tried it on Manjaro (Plasma) on the command line, and there’s no auto completion.

Hi,

On debian bullseye, it’s not activated by default either. I activated it by adding:

eval "$(kopia --completion-script-bash)"

in ~/.bashrc.

1 Like

Thank you!
Works perfect on Manjaro Linux.
Also on DietPi (NanoPi) board (Debian based)

Note it’s not activated by default because the kingpin library has some bugs which make this annoying - most importantly the filename completion is not actually working (only commands and flags are completed, but you have to type path names unaided). It would be awesome if somebody could help fix this upstream.

1 Like

FWIW, kingpin is not maintained anymore. The author says he now uses GitHub - alecthomas/kong: Kong is a command-line parser for Go

2 Likes