|
[Rivet-svn] r3525 - in trunk: . datablackhole at projects.hepforge.org blackhole at projects.hepforge.orgMon Dec 12 20:22:10 GMT 2011
Author: buckley Date: Mon Dec 12 20:22:10 2011 New Revision: 3525 Log: Adding a command line completion function for rivet-mkhtml. Modified: trunk/ChangeLog trunk/data/rivet-completion Modified: trunk/ChangeLog ============================================================================== --- trunk/ChangeLog Mon Dec 12 11:21:46 2011 (r3524) +++ trunk/ChangeLog Mon Dec 12 20:22:10 2011 (r3525) @@ -1,7 +1,11 @@ +2011-12-12 Andy Buckley <andy.buckley at cern.ch> + + * Adding a command line completion function for rivet-mkhtml. + 2011-12-12 Frank Siegert <frank.siegert at cern.ch> * Fix for factor of 2.0 in normalisation of CMS_2011_S9086218 - + * Add --ignore-missing option to rivet-mkhtml to ignore non-existing AIDA files. Modified: trunk/data/rivet-completion ============================================================================== --- trunk/data/rivet-completion Mon Dec 12 11:21:46 2011 (r3524) +++ trunk/data/rivet-completion Mon Dec 12 20:22:10 2011 (r3525) @@ -30,23 +30,23 @@ if test -x "$(which rivet 2> /dev/null)"; then anas=$(rivet --list-analyses) - if $(echo ${prev} | egrep -- "-a|--analysis|--show-analysis|--list-analyses" &> /dev/null); then + if (echo ${prev} | egrep -- "-a|--analysis|--show-analysis|--list-analyses" &> /dev/null); then COMPREPLY=( $(compgen -W "$anas" -- ${cur}) ) return 0 fi fi - if $(echo ${prev} | egrep -- "-n|--nevts|--runname|--histo-interval|--cross-section|-x|--event-timeout" &> /dev/null); then + 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 + if (echo ${prev} | egrep -- "--histo-file|-H" &> /dev/null); then _filedir aida return 0 fi - if $(echo ${prev} | egrep -- "--analysis-path|--analysis-path-append" &> /dev/null); then + if (echo ${prev} | egrep -- "--analysis-path|--analysis-path-append" &> /dev/null); then _filedir -d return 0 fi @@ -65,7 +65,6 @@ function _rivet_config() { local cur prev commands options command COMPREPLY=() - #cur=`_get_cword` cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" @@ -98,7 +97,6 @@ function _compare_histos() { local cur prev commands options command COMPREPLY=() - #cur=`_get_cword` cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" @@ -143,7 +141,6 @@ function _make_plots() { local cur prev commands options command COMPREPLY=() - #cur=`_get_cword` cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" @@ -169,13 +166,64 @@ 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 aida + return 0 +} + + +complete -F _rivet_mkhtml rivet-mkhtml + + ############################## function _aida2flat() { local cur prev commands options command COMPREPLY=() - #cur=`_get_cword` cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" @@ -213,7 +261,6 @@ function _flat2aida() { local cur prev commands options command COMPREPLY=() - #cur=`_get_cword` cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}"
More information about the Rivet-svn mailing list |