aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2016-12-07 15:46:46 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2016-12-07 17:37:27 +0100
commitb0733190b06b3684f0994809b17543033c5c00ca (patch)
tree45b92b6c0fe4e4daaca506118ee7cef2a116b7dc
parenta197341252a6149bb1a3234ffcca915fb4ed1498 (diff)
downloadpandoc-b0733190b06b3684f0994809b17543033c5c00ca.tar.gz
Fixed bash completion for filenames with spaces.
Closes #2749.
-rw-r--r--data/bash_completion.tpl24
-rw-r--r--pandoc.hs5
2 files changed, 23 insertions, 6 deletions
diff --git a/data/bash_completion.tpl b/data/bash_completion.tpl
index 6d7e17215..45fe03f9f 100644
--- a/data/bash_completion.tpl
+++ b/data/bash_completion.tpl
@@ -1,5 +1,3 @@
-#!/bin/bash
-
# This script enables bash autocompletion for pandoc. To enable
# bash completion, add this to your .bashrc:
# eval "$(pandoc --bash-completion)"
@@ -15,6 +13,7 @@ _pandoc()
opts="%s"
informats="%s"
outformats="%s"
+ highlight_styles="%s"
datadir="%s"
case "${prev}" in
@@ -38,8 +37,24 @@ _pandoc()
COMPREPLY=( $(compgen -W "reference.odt reference.docx $(find ${datadir} | sed -e 's/.*\/data\///')" -- ${cur}) )
return 0
;;
+ --wrap)
+ COMPREPLY=( $(compgen -W "auto none preserve" -- ${cur}) )
+ return 0
+ ;;
+ --track-changes)
+ COMPREPLY=( $(compgen -W "accept reject all" -- ${cur}) )
+ return 0
+ ;;
+ --reference-location)
+ COMPREPLY=( $(compgen -W "block section document" -- ${cur}) )
+ return 0
+ ;;
+ --top-level-division)
+ COMPREPLY=( $(compgen -W "section chapter part" -- ${cur}) )
+ return 0
+ ;;
--highlight-style)
- COMPREPLY=( $(compgen -W "pygments tango espresso zenburn kate monochrome haddock" -- ${cur}) )
+ COMPREPLY=( $(compgen -W "${highlight_styles}" -- ${cur}) )
return 0
;;
*)
@@ -52,7 +67,8 @@ _pandoc()
return 0
;;
*)
- COMPREPLY=( $(compgen -f ${cur}) )
+ local IFS=$'\n'
+ COMPREPLY=( $(compgen -X '' -f ${cur}) )
return 0
;;
esac
diff --git a/pandoc.hs b/pandoc.hs
index 0c2bcec5d..89681258f 100644
--- a/pandoc.hs
+++ b/pandoc.hs
@@ -478,7 +478,7 @@ options =
case safeRead ("Wrap" ++ uppercaseFirstLetter arg) of
Just o -> return opt { optWrapText = o }
Nothing -> err 77 "--wrap must be auto, none, or preserve")
- "[auto|none|preserve]")
+ "auto|none|preserve")
"" -- "Option for wrapping text in output"
, Option "" ["columns"]
@@ -609,7 +609,7 @@ options =
Just tlDiv -> return opt { optTopLevelDivision = tlDiv }
_ -> err 76 ("Top-level division must be " ++
"section, chapter, part, or default"))
- "[section|chapter|part]")
+ "section|chapter|part")
"" -- "Use top-level division type in LaTeX, ConTeXt, DocBook"
, Option "N" ["number-sections"]
@@ -912,6 +912,7 @@ options =
UTF8.hPutStrLn stdout $ printf tpl allopts
(unwords (map fst readers))
(unwords (map fst writers))
+ (unwords $ map fst highlightingStyles)
ddir
exitSuccess ))
"" -- "Print bash completion script"