borg
borg copied to clipboard
Archive name shell completion
My archive names look like this:
hostname-username-2016-11-10_11:57:54.507433
When I want to look inside an archive I have to type the whole name or copy/paste it with the mouse. Would it be possible to auto complete the name of an archive?
Like:
borg list /path/to/repo::ho<hit TAB> ->
resulting in:
borg list /path/to/repo::hostname-username-2016-11-10_11:57:54.507433
There is already a bug → #1782 for bash command completion.
There is already completion for zsh. But i am not sure if it supports archive names.
I have tried it on zsh, but archive names are not supported.
One problem with auto-completion archive name is that with a encrypted repo (default) it would need the key passphrase to get the archive list.
But maybe auto-completion is not that important for a tool like borg: backups are usually automated (no a.c. needed), restores and other maintenance are not that frequent (after initial setup phase).
Should be implemented with borg shell #1104 or/and if borg-agent gets developed.
There are precedents for this. E.g. scp bash completion completes on remote paths in Ubuntu
This feature can easily prevent annoying typos and similar stuff (just think if you have the time with seconds included in your archive name), so I'll support it.
BTW, it's not a question, but a feature request (enhancement).
it would need the key passphrase to get the archive list.
Likely a shell completion can run "borg list" in the background… And if there is no password, then the user has to enter it…
Note: for borg2 (master branch), this would need to be "archive ID shell completion", because now the ID is the unique identifier and the name does not need to be unique anymore.
I fixed the fish archive name completion in #8899.
It now completes aid:XXXXXXXX and the list shown to the user to select from also contains the archive (series) name and the timestamp. That way it is possible to comfortably work with archive series, where all archives have the same name, but different IDs and timestamps.
The bash and zsh completions still need a similar fix, but that needs help from someone familiar with such completion scripting (I am not).
Closing due to #9172.