I love git-annex. It works extremely well, its documentation is excellent, and Joey Hess, its main developper, is amazingly reactive when you tell him about a bug or ask him any question about this software. I’m currently using git-annex to manage almost 1 TB of data, spread over my laptop, my NAS, a few external hard drives, and my hubiC account. (Yes, git-annex is also designed to be able to use many different storage backends, and it’s really easy to write new ones, which I did for hubiC; more on that later…)
issue annoyance with git-annex is the lack of completion when using ZSH. The completion for git is
amazing, so it’s quite weird to have nothing for git-annex.
But as often with free software, someone has already started scratching that itch: I found a basic completion function for git-annex! It’s for an old version of git-annex, but I’ve been able to update it to the latest version of git-annex:
- added support for new git-annex subcommands (metadata, groups and wanted content, etc.)
- added better description for common arguments
- added specific arguments to all subcommands
- fixed a bug when attempting to run git-annex in a non-git directory
- update the Python code to Python 3
- fix remotes and backends completion
The updated code is available on https://github.com/Schnouki/git-annex-zsh-completion. To install that, just copy the
_git-annex file to some directory in your
$fpath (I use
$HOME/.config/zsh/completion), and run
path/to/_git-annex. You will also need to have Python 3 somewhere in your
python3 (tested with 3.4, should
work with 3.2+).
Many, many thanks to the awesome people who started this completion function: Frank Terbeck and Valentin Haenel. And to Joey for his amazing work on git-annex.