|
[Rivet-svn] r4307 - in trunk: . bin datablackhole at projects.hepforge.org blackhole at projects.hepforge.orgMon May 27 15:27:26 BST 2013
Author: buckley Date: Mon May 27 15:27:26 2013 New Revision: 4307 Log: Moving the rivet-completion script from the data dir to bin (the completion is for scripts in bin, and this makes development easier). Added: trunk/bin/rivet-completion - copied unchanged from r4306, trunk/data/rivet-completion Deleted: trunk/data/rivet-completion Modified: trunk/ChangeLog trunk/bin/Makefile.am trunk/data/Makefile.am Modified: trunk/ChangeLog ============================================================================== --- trunk/ChangeLog Mon May 27 15:23:22 2013 (r4306) +++ trunk/ChangeLog Mon May 27 15:27:26 2013 (r4307) @@ -1,5 +1,9 @@ 2013-05-27 Andy Buckley <andy.buckley at cern.ch> + * Moving the rivet-completion script from the data dir to bin (the + completion is for scripts in bin, and this makes development + easier). + * Updating bash completion scripts for YODA format and compare-histos -> rivet-cmphistos. 2013-05-23 Andy Buckley <andy.buckley at cern.ch> Modified: trunk/bin/Makefile.am ============================================================================== --- trunk/bin/Makefile.am Mon May 27 15:23:22 2013 (r4306) +++ trunk/bin/Makefile.am Mon May 27 15:27:26 2013 (r4307) @@ -7,13 +7,27 @@ rivet-mkanalysis rivet-buildplugin \ rivet-findid rivet-which \ rivet-cmphistos rivet-mkhtml - # TODO: reinstate rivet-rescale rivet-mergeruns rivet-merge-CDF_2012_NOTE10874 + # TODO: reinstate rivet-rescale rivet-mergeruns rivet-merge-CDF_2012_NOTE10874 if ENABLE_PYEXT dist_bin_SCRIPTS += $(RIVETPROGS) else EXTRA_DIST += $(RIVETPROGS) endif +## bash completion +if ENABLE_PYEXT +dist_pkgdata_DATA = rivet-completion +bashcomp_dir = $(prefix)/etc/bash_completion.d +install-data-local: + if [[ -d "$(bashcomp_dir)" && -w "$(bashcomp_dir)" ]]; then \ + install --mode 644 rivet-completion $(bashcomp_dir)/; fi +uninstall-local: + rm -f $(bashcomp_dir)/rivet-completion +else +EXTRA_DIST = rivet-completion +endif + +## No-Python Rivet program noinst_PROGRAMS = rivet-nopy rivet_nopy_SOURCES = rivet-nopy.cc rivet_nopy_CPPFLAGS = -I$(top_srcdir)/include $(AM_CPPFLAGS) Copied: trunk/bin/rivet-completion (from r4306, trunk/data/rivet-completion) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/bin/rivet-completion Mon May 27 15:27:26 2013 (r4307, copy of r4306, trunk/data/rivet-completion) @@ -0,0 +1,217 @@ +## -*- sh -*- +## Analysis name completion for Rivet 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 _rivet() { + local cur prev commands options command + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + + opts="--help --verbose --quiet --version --nevts --cross-section" + opts="$opts --analysis --runname --list-analyses --show-analysis" + opts="$opts --analysis-path --analysis-path-append --pwd" + opts="$opts --histo-file --histo-interval --event-timeout" + opts="$opts -a -A -n -h -x -H -l -v -q" + if [[ ${cur} == -* ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + if test -n "$COMPREPLY"; then + return 0 + fi + fi + + if (echo ${prev} | egrep -- "-\<a\>|--\<analysis\>|--\<show-analysis\>|--\<list-analyses\>" &> /dev/null); then + anas=$(rivet --list-analyses --quiet) + COMPREPLY=( $(compgen -W "$anas" -- ${cur}) ) + return 0 + fi + + if (echo ${prev} | egrep -- "\<-n\>|--\<nevts\>|--\<runname\>|--\<histo-interval\>|--\<cross-section\>|\<-x\>|--\<event-timeout\>" &> /dev/null); then + COMPREPLY=() + return 0 + fi + + if (echo ${prev} | egrep -- "--\<histo-file\>|\<-H\>" &> /dev/null); then + _filedir yoda + return 0 + fi + + if (echo ${prev} | egrep -- "--\<analysis-path\>|--\<analysis-path-append\>" &> /dev/null); then + _filedir -d + return 0 + fi + + _filedir + return 0 +} + + +complete -F _rivet rivet + + +########################## + + +function _rivet_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 --datadir" + opts="$opts --pythonpath --cppflags --ldflags --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 _rivet_config rivet-config + + +############################## + + +function _rivet_cmphistos() { + local cur prev commands options command + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + + opts="--help -h" + opts="$opts --outdir -o" + opts="$opts --rivet-refs -R --no-rivet-refs" + opts="$opts --histogram-list -l" + opts="$opts --hier-out --linear --logarithmic --mc-errs" + opts="$opts --no-ratio --rel-ratio --abs-ratio" + opts="$opts --all --show-mc-only --show-single --refid" + opts="$opts --no-plottitle" + opts="$opts --plotinfodir" + opts="$opts --no-rmgapbins" + opts="$opts --quiet -q --verbose -v" + if [[ ${cur} == -* ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + if test -n "$COMPREPLY"; then + return 0 + fi + fi + + if [[ ${prev} == "--plotinfodir" ]] ; then + _filedir -d + return 0 + fi + + if [[ ${prev} == "--show-single" ]]; then + COMPREPLY=( $(compgen -W "no mc ref all" -- ${cur}) ) + return 0 + fi + + _filedir yoda + return 0 +} + + +complete -F _rivet_cmphistos -o default rivet-cmphistos + + +############################## + + +function _make_plots() { + local cur prev commands options command + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + + opts="--help -h" + opts="$opts --num-threads -n" + opts="$opts --palatino --cm --times --minion" + opts="$opts --ps --pdf --eps --png --pdfpng --pspng" + opts="$opts --tex --no-cleanup --full-range" + opts="$opts --config -c" + opts="$opts --quiet -q --verbose -v" + if [[ ${cur} == -* ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + if test -n "$COMPREPLY"; then + return 0 + fi + fi + + _filedir dat + return 0 +} + + +complete -F _make_plots -o default make-plots + + +######################## + + +function _rivet_mkhtml() { + local cur prev commands options command + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + + opts="--help -h" + opts="$opts --outputdir -o" + opts="$opts --title -t" + opts="$opts --config -c" + opts="$opts --single -s" + opts="$opts --no-ratio --mc-errs --refid" + opts="$opts --num-threads --n" + opts="$opts --pdf --ps --booklet" + opts="$opts --ignore-unvalidated -i" + opts="$opts --match -m" + opts="$opts --unmatch -M" + opts="$opts --verbose -v" + if [[ ${cur} == -* ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + if test -n "$COMPREPLY"; then + return 0 + fi + fi + + ## Options with files / directories as the arg + if (echo ${prev} | egrep -- "--\<outputdir\>|\<-o\>" &> /dev/null); then + _filedir -d + return 0 + fi + if (echo ${prev} | egrep -- "--\<config\>|\<-c\>" &> /dev/null); then + _filedir + return 0 + fi + + ## Options without an completeable arg + if (echo ${prev} | egrep -- "\<-t\>|--\<title\>|--\<refid\>|--\<n\>|--\<num-threads\>|\<-m\>|--\<match\>|\<-M\>|--\<unmatch\>" &> /dev/null); then + COMPREPLY=() + return 0 + fi + + _filedir yoda + return 0 +} + + +complete -F _rivet_mkhtml rivet-mkhtml Modified: trunk/data/Makefile.am ============================================================================== --- trunk/data/Makefile.am Mon May 27 15:23:22 2013 (r4306) +++ trunk/data/Makefile.am Mon May 27 15:27:26 2013 (r4307) @@ -1,19 +1 @@ -## bash completion -if ENABLE_PYEXT - -dist_pkgdata_DATA = rivet-completion -bashcomp_dir = $(prefix)/etc/bash_completion.d -install-data-local: - if [[ -d "$(bashcomp_dir)" && -w "$(bashcomp_dir)" ]]; then \ - install --mode 644 rivet-completion $(bashcomp_dir)/; fi -uninstall-local: - rm -f $(bashcomp_dir)/rivet-completion - -else - -EXTRA_DIST = rivet-completion - -endif - - SUBDIRS = refdata anainfo plotinfo texmf
More information about the Rivet-svn mailing list |