picongpu
picongpu copied to clipboard
TBG arguments usage help
When using the tbg program the help information displays the following usage
...
usage: tbg -c [cfgFile] [-s [submitsystem]] [-t [templateFile]]
[-o "VARNAME1=10 VARNAME2=5"] [-f] [-h]
[projectPath] destinationPath
...
From how I read this usage help, I would assume, that I can start a simulation with:
tbg -c cfgFile destinationPath
that means, the -s and -t arguments are optional. But when I execute the command like that nothing happens.
When I execute the tbg command with the following arguments, it works. So it seems that the arguments -s and -t are necessary
tbg -c cfgFile -s -t destinationPath
Is this something that is not written clearly in the usage help or a bug that shouldn't happen?
~~This seems like the same question as in #4224, please see the explanations there.~~
Edit: upon offline discussion, it's another question actually.
So that text help string is written manually, not auto-generated. As far as I can see, internally -c is treated same way as -s and -t, so probably in the help string it should be -c [cfgFile] -s [submitsystem] -t [templateFile] instead.
I am surprised. I regularly use tbg without -s, but never without -t and I think usage without -t does not make sense.
Yes and it actually does not work without -t. I am not exactly sure whether tbg waits for input via stdin when started without -t, however, even this behavior is not in line with the behavior described in the help message.
@psychocoderHPC
All is fine the help looks correct.
echo "-t | --tpl [file] - Template to create a batch file from."
echo " tbg will use stdin, if no file is specified."
echo " Default: [templateFile] via export TBG_TPLFILE"
Maybe the doc should be tbg will use stdin, if -t is not present.. I think the doc is not precise because the behavior for -t without a file was added later on and we missed to update the doc string. -t without file will use the variable TBG_TPLFILE for the file name.
tbg -c cfgFile -s -t destinationPath is not working because the definition of the help string is egetopt -o t::c::s::o:fh -l tpl::,cfg::,submit::,force,help -n tbg ++ "$@
egetopt is not supporting that a parameter defined with :: (optional argument) is that last parameter.
help of egetopt
echo "ATTENTION:"
echo " - if you require at least one non-option argument (an argument not"
echo " starting with - or --) the result is only valid when you allow"
echo " minimum one non-option argument"
echo " - If more than one non option argument is given and the last"
echo " option has an optional argument the argument is assigned to"
echo " the option"
echo " e.g. --foo has an optional argument"
echo " --foo ALICE BOB is the same as --foo=ALICE BOB"
echo " BOB --foo ALICE is the same as BOB --foo=ALICE"
The original linux tool getopt is not able to handle optional arguments. egetopt is a tool I wrote, I was never able to workaround this limitation.
The correct usage is:
tbg -s -t -c cfgFile destinationPath
Anyone volunteering to provide a fix (for the help message of tbg)? @lennertsprenger @psychocoderHPC @steindev