summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Gnatenko <i.gnatenko.brain@gmail.com>2014-06-18 16:05:21 +0400
committerIgor Gnatenko <i.gnatenko.brain@gmail.com>2014-06-18 16:05:21 +0400
commitff47f2492fae26327bdd7d1f3f12d135c1f137bb (patch)
tree78d973651008f725d98ec3202ba65ba0f4aba824
parent42093e4f69bb0ee78c7fe5567142e09bfc01b1f8 (diff)
parent477b9cc09cd5a3aae2bbaea932bb68df9b6fefd8 (diff)
downloadappstream-glib-ff47f2492fae26327bdd7d1f3f12d135c1f137bb.tar.gz
Merge branch 'wip/bash-completion'
-rw-r--r--AUTHORS1
-rw-r--r--data/appstream-util29
2 files changed, 30 insertions, 0 deletions
diff --git a/AUTHORS b/AUTHORS
index 026b705..8071a47 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1 +1,2 @@
Richard Hughes <richard@hughsie.com>
+Igor Gnatenko <i.gnatenko.brain@gmail.com>
diff --git a/data/appstream-util b/data/appstream-util
index 4816fd6..70dd42a 100644
--- a/data/appstream-util
+++ b/data/appstream-util
@@ -31,6 +31,12 @@ _appstream-util()
fi
done
+ # How many'th non-option arg (1-based) for $command are we completing?
+ local i nth=1
+ for (( i=commandix+1; i < cword; i++ )); do
+ [[ ${words[i]} == -* ]] || (( nth++ ))
+ done
+
case $prev in
-h|--help|--version)
return
@@ -56,11 +62,34 @@ _appstream-util()
non-package-yaml|status-html)
ext='@(xml.gz)'
;;
+ appdata-from-desktop)
+ case $nth in
+ 1)
+ ext='@(desktop?(.in))'
+ ;;
+ 2)
+ COMPREPLY=( $( compgen -W '$( echo $prev | \
+ sed -e "s/desktop/appdata.xml/g" )' -- "$cur" ) )
+ ext=''
+ ;;
+ esac
+ ;;
+ convert)
+ case $nth in
+ 1)
+ ext='@(xml.gz|appdata.xml?(.in))'
+ ;;
+ *)
+ ext=''
+ ;;
+ esac
+ ;;
*)
;;
esac
[[ -n $ext ]] && _filedir $ext
return
+
fi
if [[ $cur == -* ]]; then