git.iko.soy/typeable/pandoc
on 2.13 help sign in
typeable/pandoc/data/bash_completion.tpl
82 lines 2.5 kB history raw
1# This script enables bash autocompletion for pandoc. To enable
2# bash completion, add this to your .bashrc:
3# eval "$(pandoc --bash-completion)"
5_pandoc()
6{
7 local cur prev opts lastc informats outformats datafiles
8 COMPREPLY=()
9 cur="${COMP_WORDS[COMP_CWORD]}"
10 prev="${COMP_WORDS[COMP_CWORD-1]}"
12 # These should be filled in by pandoc:
13 opts="%s"
14 informats="%s"
15 outformats="%s"
16 highlight_styles="%s"
17 datafiles="%s"
19 case "${prev}" in
20 --from|-f|--read|-r)
21 COMPREPLY=( $(compgen -W "${informats}" -- ${cur}) )
22 return 0
23 ;;
24 --to|-t|--write|-w|-D|--print-default-template)
25 COMPREPLY=( $(compgen -W "${outformats}" -- ${cur}) )
26 return 0
27 ;;
28 --email-obfuscation)
29 COMPREPLY=( $(compgen -W "references javascript none" -- ${cur}) )
30 return 0
31 ;;
32 --ipynb-output)
33 COMPREPLY=( $(compgen -W "all none best" -- ${cur}) )
34 return 0
35 ;;
36 --pdf-engine)
37 COMPREPLY=( $(compgen -W "pdflatex lualatex xelatex latexmk tectonic wkhtmltopdf weasyprint prince context pdfroff" -- ${cur}) )
38 return 0
39 ;;
40 --print-default-data-file)
41 COMPREPLY=( $(compgen -W "${datafiles}" -- ${cur}) )
42 return 0
43 ;;
44 --wrap)
45 COMPREPLY=( $(compgen -W "auto none preserve" -- ${cur}) )
46 return 0
47 ;;
48 --track-changes)
49 COMPREPLY=( $(compgen -W "accept reject all" -- ${cur}) )
50 return 0
51 ;;
52 --reference-location)
53 COMPREPLY=( $(compgen -W "block section document" -- ${cur}) )
54 return 0
55 ;;
56 --top-level-division)
57 COMPREPLY=( $(compgen -W "section chapter part" -- ${cur}) )
58 return 0
59 ;;
60 --highlight-style)
61 COMPREPLY=( $(compgen -W "${highlight_styles}" -- ${cur}) )
62 return 0
63 ;;
64 *)
65 ;;
66 esac
68 case "${cur}" in
69 -*)
70 COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
71 return 0
72 ;;
73 *)
74 local IFS=$'\n'
75 COMPREPLY=( $(compgen -X '' -f "${cur}") )
76 return 0
77 ;;
78 esac
82complete -o filenames -o bashdefault -F _pandoc pandoc