From b0733190b06b3684f0994809b17543033c5c00ca Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Wed, 7 Dec 2016 15:46:46 +0100 Subject: Fixed bash completion for filenames with spaces. Closes #2749. --- data/bash_completion.tpl | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'data/bash_completion.tpl') 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 -- cgit v1.2.3