[feature] more shell completions
Describe your proposed improvement and the problem it solves.
Now pandoc --bash-completion can generate bash completion script. Why not provide more --XXsh-completion?
For example, zsh has a completion script
for pandoc, however, it is written manually:
_arguments -s \
{-f+,-r+,--from=,--read=}'[specify input format]: :_pandoc_format -T input' \
{-t+,-w+,--to=,--write=}'[specify output format]: :_pandoc_format -T output' \
{-o+,--output=}'[write output to FILE instead of stdout]:file:_files' \
'--data-dir=[specify the user data directory to search for pandoc data files]:data directory:_files -/' \
{-d+,--defaults=}'[read default from YAML file]: :_pandoc_defaults_file' \
'--shift-heading-level-by=[shift heading levels by specified number]:positive or negative integer: ' \
'!--base-header-level=:number [1]:(1 2 3 4 5)' \
'!--strip-empty-paragraphs[deprecated. Use the +empty_paragraphs extension instead]' \
'--indented-code-classes=[classes to use for indented code blocks]:class list (comma-separated)' \
'--default-image-extension=[specify a default extension to use when image paths/URLs have no extension]:extension: ' \
'--file-scope[parse each file individually before combining for multifile documents]' \
...
When the option of pandoc changed, the maintainers of zsh have to update it manually. If pandoc can provide --zsh-completion which use this file as a template but update automatically, it will be greater.
TIA!
Related: #4668.
As noted in the linked issue: I don't want to integrate a completion script that is mostly manually written. If it can be done in a template form like the bash completions, we could consider it.
If it can be done in a template form like the bash completions, we could consider it.
zsh support completing the descriptions of options, that is:
For zsh:
❯ pandoc --<TAB>
option
--abbreviations specifies a custom abbreviations file
--ascii use only ASCII characters in output, supported only for HTML and DocBook output
--bash-completion generate a bash completion script
--biblatex use biblatex for citations in LaTeX output
...
For bash which don't support descriptions of options.
$ pandoc --<TAB>
--ascii
--atx-headers
--base-header-level
--bash-completion
--biblatex
...
However, the descriptions of options exists in the man page, which is generated from a markdown file MANUAL.txt by pandoc.
However pandoc --zsh-completion cannot access MANUAL.txt. I think use
a script to handle MANUAL.txt to generate zsh completion script _pandoc is
a little weird. Otherwise users have to give up the descriptions of options.
Moreover, zsh wants concise half-line descriptions, and MANUAL.txt won't provide those.
zsh wants concise half-line descriptions, and MANUAL.txt won't provide those.
Right. It looks like before this problem is fixed, the support for zsh compleiton is hard to realize.
With pandoc 3.1.11.1 on Debian, still:
$ cat --<TAB>
--help --show-tabs --version ...
$ pandoc --<TAB>
Nothing.
@jidanni Isn't that a Debian packaging issue rather than anything specific to this project? We do provide a way to get shell completions, but the system has to be set up to integrate them....
OK, I filed https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1121654