[csw-devel] SF.net SVN: opencsw:[359] gar-wrapper/bash_completion.mgar

skayser at users.sourceforge.net skayser at users.sourceforge.net
Fri Mar 11 19:11:25 CET 2011


Revision: 359
          http://opencsw.svn.sourceforge.net/opencsw/?rev=359&view=rev
Author:   skayser
Date:     2011-03-11 18:11:25 +0000 (Fri, 11 Mar 2011)

Log Message:
-----------
mgar: add bash autocompletion

Added Paths:
-----------
    gar-wrapper/bash_completion.mgar

Added: gar-wrapper/bash_completion.mgar
===================================================================
--- gar-wrapper/bash_completion.mgar	                        (rev 0)
+++ gar-wrapper/bash_completion.mgar	2011-03-11 18:11:25 UTC (rev 359)
@@ -0,0 +1,38 @@
+#
+# bash autocompletion prototype for mgar. Valid cmds assembled manually.
+# Ideally, we could derive them from mgar & GAR in an automated fashion
+# or at least verify that they are - with changing versions - actually
+# supported in mgar or GAR. This will do for now though.
+#
+
+_mgar() {
+  local cur prev opts
+  COMPREPLY=()
+  cur="${COMP_WORDS[COMP_CWORD]}"
+  prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+  buildtgts="fetch makesum extract configure build package clean spotless"
+  buildtgts="${buildtgts} makesums makepatch patch merge install platforms"
+  buildtgts="${buildtgts} reinstall remerge repackage"
+
+  for t in ${buildtgts}; do
+    [ $t == "platforms" ] && continue
+    buildtgts="${buildtgts} platforms-${t}"
+  done
+
+  misctgts="modenv ccenv"
+
+  mgarcmds="help init index locate up commit show-srcdir show-stagedir"
+  mgarcmds="${mgarcmds} find-file edit-file show-buildsys show-pkgtree version"
+
+  opts="${buildtgts} ${misctgts} ${mgarcmds}"
+
+  if [[ ${prev} == "mgar" ]] ; then
+    COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+    return 0
+  else 
+    COMPREPLY=( $(compgen -f ${cur}) )
+  fi
+}
+
+complete -F _mgar mgar


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


More information about the devel mailing list