Adding list folder autocompletion to Zsh
And also correcting a bug that would make it keep autocompleting folders
when the completed folder had no subfolders.
This is corrected by using compset to check for a trailing separator and
disabling autocompletion of folders when one is found.
@@ -21,7 +21,8 @@ _{{ $prog }} () {
{{- end }}
{{ if .Flags }}_arguments :{{ range .Flags }} "{{ . | formatFlag }}"{{ end }}{{ end }}
_describe -t commands "{{ $prog }} {{ .Name }}" subcommands
- {{ if or (eq .Name "copy") (eq .Name "move") (eq .Name "delete") (eq .Name "show") (eq .Name "edit") }}_{{ $prog }}_complete_passwords{{ else if or (eq .Name "insert") (eq .Name "generate") }}_{{ $prog }}_complete_folders{{ end }}
+ {{ if or (eq .Name "copy") (eq .Name "move") (eq .Name "delete") (eq .Name "show") (eq .Name "edit") }}_{{ $prog }}_complete_passwords{{ else if or (eq .Name "insert") (eq .Name "generate") (eq .Name "list") }}if ! compset -P '*/'; then _{{ $prog }}_complete_folders
+ fi{{ end }}
;;
{{- end }}
*)
