From 23747edb25fc3504301c023dbf3536bf4437b0da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Sun, 4 Oct 2015 03:08:28 -0700 Subject: [PATCH] bash-completion: add appid support for all formats --- completion/bash-completion | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/completion/bash-completion b/completion/bash-completion index 09683437..f0ce84a3 100644 --- a/completion/bash-completion +++ b/completion/bash-completion @@ -37,10 +37,16 @@ __fdroid_init() { (( $# >= 1 )) && __complete_${1} } -__package() { - files=( metadata/*.txt ) +__by_ext() { + local ext="$1" + files=( metadata/*.$ext ) files=( ${files[@]#metadata/} ) - files=${files[@]%.txt} + files=${files[@]%.$ext} + echo "$files" +} + +__package() { + files="$(__by_ext txt) $(__by_ext yaml) $(__by_ext json) $(__by_ext xml)" COMPREPLY=( $( compgen -W "$files" -- $cur ) ) }