git.iko.soy/typeable/pandoc
on master help sign in
Fixed bash completion for filenames with spaces.

Closes #2749.

commitb0733190b06b3684f0994809b17543033c5c00ca authorJohn MacFarlane <jgm@berkeley.edu> dateWed 7 Dec 2016, 15:46 (10 years ago) parenta197341
2 files changed+23−6
data/bash_completion.tpl+20−4 pandoc.hs+3−2
data/bash_completion.tpl+20−4
@@ -1,5 +1,3 @@
1−#!/bin/bash
2−
31# This script enables bash autocompletion for pandoc. To enable
42# bash completion, add this to your .bashrc:
53# eval "$(pandoc --bash-completion)"
@@ -15,6 +13,7 @@ _pandoc()
1513 opts="%s"
1614 informats="%s"
1715 outformats="%s"
16+ highlight_styles="%s"
1817 datadir="%s"
1918
2019 case "${prev}" in
@@ -38,8 +37,24 @@ _pandoc()
3837 COMPREPLY=( $(compgen -W "reference.odt reference.docx $(find ${datadir} | sed -e 's/.*\/data\///')" -- ${cur}) )
3938 return 0
4039 ;;
40+ --wrap)
41+ COMPREPLY=( $(compgen -W "auto none preserve" -- ${cur}) )
42+ return 0
43+ ;;
44+ --track-changes)
45+ COMPREPLY=( $(compgen -W "accept reject all" -- ${cur}) )
46+ return 0
47+ ;;
48+ --reference-location)
49+ COMPREPLY=( $(compgen -W "block section document" -- ${cur}) )
50+ return 0
51+ ;;
52+ --top-level-division)
53+ COMPREPLY=( $(compgen -W "section chapter part" -- ${cur}) )
54+ return 0
55+ ;;
4156 --highlight-style)
42− COMPREPLY=( $(compgen -W "pygments tango espresso zenburn kate monochrome haddock" -- ${cur}) )
57+ COMPREPLY=( $(compgen -W "${highlight_styles}" -- ${cur}) )
4358 return 0
4459 ;;
4560 *)
@@ -52,7 +67,8 @@ _pandoc()
5267 return 0
5368 ;;
5469 *)
55− COMPREPLY=( $(compgen -f ${cur}) )
70+ local IFS=$'\n'
71+ COMPREPLY=( $(compgen -X '' -f ${cur}) )
5672 return 0
5773 ;;
5874 esac
pandoc.hs+3−2
@@ -478,7 +478,7 @@ options =
478478 case safeRead ("Wrap" ++ uppercaseFirstLetter arg) of
479479 Just o -> return opt { optWrapText = o }
480480 Nothing -> err 77 "--wrap must be auto, none, or preserve")
481− "[auto|none|preserve]")
481+ "auto|none|preserve")
482482 "" -- "Option for wrapping text in output"
483483
484484 , Option "" ["columns"]
@@ -609,7 +609,7 @@ options =
609609 Just tlDiv -> return opt { optTopLevelDivision = tlDiv }
610610 _ -> err 76 ("Top-level division must be " ++
611611 "section, chapter, part, or default"))
612− "[section|chapter|part]")
612+ "section|chapter|part")
613613 "" -- "Use top-level division type in LaTeX, ConTeXt, DocBook"
614614
615615 , Option "N" ["number-sections"]
@@ -912,6 +912,7 @@ options =
912912 UTF8.hPutStrLn stdout $ printf tpl allopts
913913 (unwords (map fst readers))
914914 (unwords (map fst writers))
915+ (unwords $ map fst highlightingStyles)
915916 ddir
916917 exitSuccess ))
917918 "" -- "Print bash completion script"