diff --git a/patches/patch.sh b/patches/patch.sh index 633bd730136fe08914d2aa2268d1ac6dbd8ce17f..1158207a8c2ea6744c72917c637053b37290cf97 100755 --- a/patches/patch.sh +++ b/patches/patch.sh @@ -75,6 +75,7 @@ do (--list-engines|-l) test -n "$action" && multiple_actions=yes ; action=list ;; (--info|-i) test -n "$action" && multiple_actions=yes ; action=info ;; (--new=*) test -n "$action" && multiple_actions=yes ; action=new ; newpatch="${prefix_option#--new=}" ;; + (--options) test -n "$action" && multiple_actions=yes ; action=options ;; (--description) echo "patch an MD engine" ; exit ;; (--engine=*) engine="${prefix_option#--engine=}" ;; (--mdroot=*) mdroot="${prefix_option#--mdroot=}" ;; @@ -114,6 +115,11 @@ if [ -z "$action" ] ; then exit fi +if [ "$action" = options ] ; then + echo "--help -h --patch -p --save -s --save-originals --revert -R -r --list-engines -l --info -i --new --options --description --engine --mdroot --mode --diff --engine -e --mdroot --root --diff -d --mode -m --new -n --static --shared --runtime --force -f --quiet -q" + exit 0 +fi + test -n "$quiet" || echo "PLUMED patching tool" test -n "$quiet" || echo if [ -z "$PLUMED_ROOT" ] diff --git a/scripts/config.sh b/scripts/config.sh index 727d3e8cad1a3a5a26581a655cc7471a165f86fc..47526f0c2801b45a4896b6b13e237c70a9a26d64 100755 --- a/scripts/config.sh +++ b/scripts/config.sh @@ -40,6 +40,10 @@ do echo "inquire plumed about how it was configure" exit 0 ;; + (--options) + echo "--help -h --description --options --quiet -q --version -v show has module" + exit 0 + ;; (--quiet|-q) quiet=yes ;; (--version|-v) action=version ;; (show) diff --git a/scripts/mklib.sh b/scripts/mklib.sh index 2612a488ab01d8a125ed8c7b4c497fb876a108a3..55f7c4004cb7d36a92b4e60157983380fcb8b32c 100755 --- a/scripts/mklib.sh +++ b/scripts/mklib.sh @@ -7,6 +7,11 @@ if [ "$1" = --description ] ; then exit 0 fi +if [ "$1" = --options ] ; then + echo "--description" + exit 0 +fi + if [ $# != 1 ] || [[ "$1" != *.cpp ]] ; then echo "ERROR" diff --git a/scripts/newcv.sh b/scripts/newcv.sh index b3b57373937bae656cfb8c99458f96712c0a27ba..727c90a93f28059577dd919a1238a3c85da40333 100755 --- a/scripts/newcv.sh +++ b/scripts/newcv.sh @@ -5,6 +5,11 @@ if [ "$1" = --description ] ; then exit 0 fi +if [ "$1" = --options ] ; then + echo "--description" + exit 0 +fi + if [ $# != 2 ] ; then echo "ERROR" diff --git a/scripts/partial_tempering.sh b/scripts/partial_tempering.sh index d4ba669853604c516ee19998dd0b6c94fbb0181d..b90aead9b61ee62ce97633912af4128b626f7754 100755 --- a/scripts/partial_tempering.sh +++ b/scripts/partial_tempering.sh @@ -4,6 +4,11 @@ if [ "$1" = --description ] ; then exit 0 fi +if [ "$1" = --options ] ; then + echo "--description --gromacs4 --help -h" + exit 0 +fi + if [ "$1" = --help ] || [ "$1" = -h ] ; then cat <<EOF Usage: diff --git a/scripts/vim2html.sh b/scripts/vim2html.sh index a9f6a43cbf997df4145db79965e89b73f58ad3ab..0c727e622e5211630fdf8c99d24e734e4ffda2be 100755 --- a/scripts/vim2html.sh +++ b/scripts/vim2html.sh @@ -7,6 +7,11 @@ if [ "$1" = --description ] ; then exit 0 fi +if [ "$1" = --options ] ; then + echo "--description --options --annotate-syntax --pdf --crop --fs --colors" + exit 0 +fi + if [ "$1" = --help ] ; then cat << EOF Usage: diff --git a/src/cltools/Completion.cpp b/src/cltools/Completion.cpp index ccc3b4cf68c35697cb2d8fc753fde9f3d58a1c42..087b213f7a05e2ed49ddba7b10f9122e02a30f2d 100644 --- a/src/cltools/Completion.cpp +++ b/src/cltools/Completion.cpp @@ -117,6 +117,33 @@ int Completion::main(FILE* in, FILE*out,Communicator& pc) { fprintf(out,"\"\n"); } + for(unsigned j=0; j<tmp.size(); j++) { + std::string s=tmp[j]; +// handle - sign (convert to underscore) + for(;;) { + size_t n=s.find("-"); + if(n==std::string::npos) break; + s[n]='_'; + } + fprintf(out,"local cmd_keys_%s=\"",s.c_str()); + std::string cmd=config::getEnvCommand()+" \""+config::getPlumedRoot()+"/scripts/"+s+".sh\" --options"; + FILE *fp=popen(cmd.c_str(),"r"); + std::string line,manual; + while(Tools::getline(fp,line))manual+=line; + pclose(fp); + std::vector<std::string> keys=Tools::getWords(manual); + for(unsigned k=0; k<keys.size(); k++) { +// handle --help/-h + std::string s=keys[k]; + for(;;) { + size_t n=s.find("/"); + if(n==std::string::npos) break; + s[n]=' '; + } + fprintf(out," %s",s.c_str()); + } + fprintf(out,"\"\n"); + } fprintf(out,"%s\n",completion); std::string name=config::getPlumedProgramName();