A contrib/completions/_hello-hut => contrib/completions/_hello-hut +11 -0
@@ 0,0 1,11 @@
+#compdef hello-hut
+# zsh completion for hello-hut; copy into a directory on your $fpath.
+
+_arguments \
+ '--shout[print the greeting in capitals]' \
+ '--time-of-day[say good morning, afternoon or evening]' \
+ '--count[repeat the greeting]:count:' \
+ '--color[colorize the output]:when:(auto always never)' \
+ '--format[output format]:format:(text json)' \
+ '--version[show the version and exit]' \
+ '1::name:'
A contrib/completions/hello-hut.bash => contrib/completions/hello-hut.bash +16 -0
@@ 0,0 1,16 @@
+# bash completion for hello-hut
+# Copy to ~/.local/share/bash-completion/completions/hello-hut
+
+_hello_hut() {
+ local cur opts
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ opts="--shout --time-of-day --count --color --format --version --help"
+ case "${COMP_WORDS[COMP_CWORD-1]}" in
+ --color) COMPREPLY=($(compgen -W "auto always never" -- "$cur")); return ;;
+ --format) COMPREPLY=($(compgen -W "text json" -- "$cur")); return ;;
+ esac
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=($(compgen -W "$opts" -- "$cur"))
+ fi
+}
+complete -F _hello_hut hello-hut
M docs/install.md => docs/install.md +9 -0
@@ 22,4 22,13 @@ To try it without installing anything:
PYTHONPATH=src python3 -m hello_hut Ada
```
+## Shell completions
+
+Bash and zsh completions live in `contrib/completions/`:
+
+| Shell | Copy this file | To |
+| --- | --- | --- |
+| bash | `hello-hut.bash` | `~/.local/share/bash-completion/completions/hello-hut` |
+| zsh | `_hello-hut` | any directory on your `$fpath` |
+
Next: [configure hello-hut](configuration.md).