git.iko.soy/typeable/pandoc
on mallard help sign in
typeable/pandoc/data/bash_completion.tpl
62 lines 1.7 kB history raw
1#!/bin/bash
3# This script enables bash autocompletion for pandoc. To enable
4# bash completion, add this to your .bashrc:
5# eval "$(pandoc --bash-completion)"
7_pandoc()
8{
9 local cur prev opts lastc informats outformats datadir
10 COMPREPLY=()
11 cur="${COMP_WORDS[COMP_CWORD]}"
12 prev="${COMP_WORDS[COMP_CWORD-1]}"
14 # These should be filled in by pandoc:
15 opts="%s"
16 informats="%s"
17 outformats="%s"
18 datadir="%s"
20 case "${prev}" in
21 --from|-f|--read|-r)
22 COMPREPLY=( $(compgen -W "${informats}" -- ${cur}) )
23 return 0
24 ;;
25 --to|-t|--write|-w|-D|--print-default-template)
26 COMPREPLY=( $(compgen -W "${outformats}" -- ${cur}) )
27 return 0
28 ;;
29 --email-obfuscation)
30 COMPREPLY=( $(compgen -W "references javascript none" -- ${cur}) )
31 return 0
32 ;;
33 --latex-engine)
34 COMPREPLY=( $(compgen -W "pdflatex lualatex xelatex" -- ${cur}) )
35 return 0
36 ;;
37 --print-default-data-file)
38 COMPREPLY=( $(compgen -W "reference.odt reference.docx $(find ${datadir} | sed -e 's/.*\/data\///')" -- ${cur}) )
39 return 0
40 ;;
41 --highlight-style)
42 COMPREPLY=( $(compgen -W "pygments tango espresso zenburn kate monochrome haddock" -- ${cur}) )
43 return 0
44 ;;
45 *)
46 ;;
47 esac
49 case "${cur}" in
50 -*)
51 COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
52 return 0
53 ;;
54 *)
55 COMPREPLY=( $(compgen -f ${cur}) )
56 return 0
57 ;;
58 esac
62complete -F _pandoc pandoc