users > No man pages / help for SVN version
Showing 1-3 of 3 posts
Display:
Results per page:
Dec 9, 2013  08:12 PM | Ashley Manton
No man pages / help for SVN version
I have just downloaded and built the latest version from SVN and cannot access any help or man pages for any of the tools. The problem seems to be with the cmtk shell script in /usr/local/bin/, particularly the lines:
if echo "$CMD $@" | grep -q -e --help; then
  [ "$CMD" = "--help" ] && man cmtk || man <( ${CMDPATH} --man )
else

Changing these to:
if echo "$CMD $@" | grep -q -e --help; then
  if [ "$CMD" = "--help" ]; then man cmtk; else man cmtk-$CMD; fi
else
seems to fix this, in as much as it makes man pages accessible.

Also, I presume that there is supposed to be a man page for cmtk overall, listing the commands available, or similar, judging by the 'man cmtk' command, although this does not appear to exist. Am I mistaken?
Dec 9, 2013  09:12 PM | Torsten Rohlfing
RE: No man pages / help for SVN version
Hi Ashley -

Yaroslav Halchenko wrote the script you are having trouble with, and I am a bit swamped right now to try and understand what he might have been thinking there ;)

In general, you can run each CMTK binary tool with "--help" option to get a list of (basic) options. If you are interested in the more involved advanced options also, use "--help-all" instead. Clearly, the decision which options are advanced or not that I made may not coincide with your perception, so by all means, try "--help-all".

There is not a man page for CMTK as a whole per se, although Yaroslav's script is, I believe, "faking" that by running all tools with the "--man" option and assembling an overall man page from the per-tool pages.

Hope this helps a little.

Best,
Torsten
Dec 10, 2013  02:12 PM | Ashley Manton
RE: No man pages / help for SVN version
Thanks, Torsten. I have almost no experience with bash scripting, but I've tried to recreate the behaviour you've described in the following modified script (except that the 'fake' man page for cmtk isn't a man page as such, in case you want to add one — it just calls --help or --help-all on every tool and concatenates the results together, along with a heading for each tool name).
#!/bin/bash
bold='tput bold'
normal='tput sgr0'

allhelp() {
  for file in ${CMTK_BIN_DIR}/*
  do
    echo -e "${bold}$(basename $file)${normal}\n";
    if [ $1 == "all" ]; then $file --help-all; else $file --help; fi
  done
}

CMTK_BIN_DIR=/usr/local/lib/cmtk/bin
CMTK_LIB_DIR=/usr/local/lib/cmtk

CMD=$1
CMDPATH=${CMTK_BIN_DIR}/$CMD
shift

if [ "${LD_LIBRARY_PATH}" != "" ]; then
  export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${CMTK_LIB_DIR}
else
  export LD_LIBRARY_PATH=${CMTK_LIB_DIR}
fi

if [ "$CMD" == "--help-all" ]; then allhelp "all"; elif [ "$CMD" == "--help" ] || [ "$CMD" = "" ]; then allhelp "norm"; else ${CMDPATH} "$@"; fi

exit