[yoda-svn] r602 - in trunk: . bin

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Mon May 27 15:22:10 BST 2013


Author: buckley
Date: Mon May 27 15:22:09 2013
New Revision: 602

Log:
Adding a yoda-completion file for bash.

Added:
   trunk/bin/yoda-completion
Modified:
   trunk/ChangeLog
   trunk/Makefile.am
   trunk/bin/Makefile.am

Modified: trunk/ChangeLog
==============================================================================
--- trunk/ChangeLog	Fri May 17 00:58:25 2013	(r601)
+++ trunk/ChangeLog	Mon May 27 15:22:09 2013	(r602)
@@ -1,3 +1,7 @@
+2013-05-27  Andy Buckley  <andy.buckley at cern.ch>
+
+	* Adding a yoda-completion file for bash.
+
 2013-05-17  Andy Buckley  <andy.buckley at cern.ch>
 
 	* Mapping HistoBin1D.relErr in Python.

Modified: trunk/Makefile.am
==============================================================================
--- trunk/Makefile.am	Fri May 17 00:58:25 2013	(r601)
+++ trunk/Makefile.am	Mon May 27 15:22:09 2013	(r602)
@@ -3,6 +3,7 @@
 
 EXTRA_FILES = main.dox
 
+
 ## Deal with the Doxygen stuff
 # TODO: Improve, without the Doxy performance penalty on every call of "make"
 if WITH_DOXYGEN

Modified: trunk/bin/Makefile.am
==============================================================================
--- trunk/bin/Makefile.am	Fri May 17 00:58:25 2013	(r601)
+++ trunk/bin/Makefile.am	Mon May 27 15:22:09 2013	(r602)
@@ -1 +1,14 @@
 dist_bin_SCRIPTS = yoda-config yoda2aida yoda2flat aida2yoda aida2flat
+
+## bash completion
+if ENABLE_PYEXT
+dist_pkgdata_DATA = yoda-completion
+bashcomp_dir = $(prefix)/etc/bash_completion.d
+install-data-local:
+	if [[ -d "$(bashcomp_dir)" && -w "$(bashcomp_dir)" ]]; then \
+      install --mode 644 yoda-completion $(bashcomp_dir)/; fi
+uninstall-local:
+	rm -f $(bashcomp_dir)/yoda-completion
+else
+EXTRA_DIST = yoda-completion
+endif

Added: trunk/bin/yoda-completion
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/bin/yoda-completion	Mon May 27 15:22:09 2013	(r602)
@@ -0,0 +1,146 @@
+## -*- sh -*-
+## Analysis name completion for YODA scripts
+
+(type _filedir &> /dev/null) || \
+function _filedir() {
+    local cur prev commands options command
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    COMPREPLY=( $(compgen -W "$(ls ${cur}* 2> /dev/null)" -- ${cur}) )
+    return 0
+}
+
+
+##########################
+
+
+function _yoda_config() {
+    local cur prev commands options command
+    COMPREPLY=()
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+    opts="--help --version"
+    opts="$opts --prefix --includedir --libdir"
+    opts="$opts --cxxflags --libs"
+    opts="$opts -h"
+    if [[ ${cur} == -* ]] ; then
+        COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+        if test -n "$COMPREPLY"; then
+            return 0
+        fi
+    fi
+
+    COMPREPLY=( $(compgen -W "$opts" -- ${cur}) )
+    if test -n "$COMPREPLY"; then
+        return 0
+    fi
+
+    return 0
+}
+
+
+complete -F _yoda_config yoda-config
+
+
+#############################
+
+
+function _yoda2aida() {
+    local cur prev commands options command
+    COMPREPLY=()
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+    opts="--help -h"
+
+    if [[ ${cur} == -* ]] ; then
+        COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+        if test -n "$COMPREPLY"; then
+            return 0
+        fi
+    fi
+
+    _filedir yoda
+    return 0
+}
+
+
+complete -F _yoda2aida -o default yoda2aida
+
+
+##############################
+
+
+function _yoda2flat() {
+    local cur prev commands options command
+    COMPREPLY=()
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+    opts="--help -h"
+
+    if [[ ${cur} == -* ]] ; then
+        COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+        if test -n "$COMPREPLY"; then
+            return 0
+        fi
+    fi
+
+    _filedir yoda
+    return 0
+}
+
+
+complete -F _yoda2flat -o default yoda2flat
+
+
+##############################
+
+
+function _aida2yoda() {
+    local cur prev commands options command
+    COMPREPLY=()
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+    opts="--help -h"
+
+    if [[ ${cur} == -* ]] ; then
+        COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+        if test -n "$COMPREPLY"; then
+            return 0
+        fi
+    fi
+
+    _filedir aida
+    return 0
+}
+
+
+complete -F _aida2yoda -o default aida2yoda
+
+
+##############################
+
+
+function _aida2flat() {
+    local cur prev commands options command
+    COMPREPLY=()
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+    opts="--help -h"
+
+    if [[ ${cur} == -* ]] ; then
+        COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+        if test -n "$COMPREPLY"; then
+            return 0
+        fi
+    fi
+
+    _filedir aida
+    return 0
+}
+
+
+complete -F _aida2flat -o default aida2flat


More information about the yoda-svn mailing list