Hi,
This message is a logical follow on from Gary's post at
https://mail.gna.org/public/relax-devel/2007-03/msg00004.html
(Message-id: <45EBEA6A.7030809@xxxxxxxxxxxxxxx>) and relates to the
changes of r3080
(https://mail.gna.org/public/relax-commits/2007-03/msg00021.html),
specifically the addition of the usage string.
I think it would be useful to synchronise the 'relax', 'scons', and
'unit_test_runner.py' systems. For both 'relax' and 'scons' there is
a simple message printed when the usage is incorrect:
-----
$ relax -x
usage: relax [options] [script_file]
RelaxError: no such option: -x
-----
-----
$ scons -x
usage: scons [OPTION] [TARGET] ...
SCons error: no such option: -x
-----
They also have help systems:
-----
$ relax --help
usage: relax [options] [script_file]
options:
-h, --help show this help message and exit
-d, --debug enable debugging output
-l LOG_FILE, --log=LOG_FILE
log relax output to the file LOG_FILE
--licence display the licence
-t LOG_FILE, --tee=LOG_FILE
tee relax output to stdout and the file LOG_FILE
-p, --pedantic escalate all warnings to errors
--test run relax in test mode
--test-suite execute the relax test suite
--unit-test execute the relax unit tests (part of the test suite)
--thread run relax in threading mode (this mode should not be
invoked by a user)
-v, --version show the version number and exit
-----
-----
$ scons --help
scons: Reading SConscript files ...
scons: done reading SConscript files.
Help for using Scons to build the various components of relax.
usage: scons [target]
No target:
compile the C modules
Standard targets:
install install relax
uninstall uninstall relax
binary_dist create the binary distribution packages
source_dist create the source distribution packages
clean remove the compiled and temporary files
user_manual_pdf create the user manual (PDF version)
user_manual_pdf_nofetch create the user manual (PDF version,
without fetching the docstrings)
user_manual_html create the user manual (HTML version)
user_manual_html_nofetch create the user manual (HTML version,
without fetching the docstrings)
api_manual_html create the API documentation manual (HTML version)
Specific targets:
package_bin package the binary distribution
package_src package the source distribution
gpg_bin GPG sign the binary distribution file
gpg_src GPG sign the source distribution file
version_check check the relax version number
clean_temp remove the temporary files
manual_version_file create the relax version number LaTeX file
fetch_docstrings fetch and LaTeX format the docstrings
compile_user_manual_pdf compile the PDF version of the user manual
from the LaTeX sources
compile_user_manual_html compile the HTML version of the user manual
from the LaTeX sources
compile_api_manual_html compile the HTML version of the API
documentation manual using Epydoc
manual_clean remove the temporary manual files
manual_clean_nodeps remove the temporary manual files (with no
manual environments dependent on it)
Use scons -H for help about command-line options.
-----
On the other hand, 'unit_test_runner.py' has the following incorrect
usage and help messages:
-----
$ ./unit_test_runner.py -x
usage:
unit_test_runner.py [options] [<file-or-dir>...]
a program to find and run subsets of the relax unit test suite using pyunit.
(details of how to write pyunit tests can be found in your python
distributions
library reference)
arguments:
<file-or-dir> = <file-path> | <dir-path> is a list which can contain
inter-mixed directories and files
<file-path> = a file containing a test case class files of the same
name with the first letter capitalised
e.g. maths_fns/test_chi2.py will be assumed to contain
a test case class called Test_chi2
<dir-path> = a path which will be recursivley searched for <file-path>s
which end in py
unit_test_runner.py: error: no such option: -x
-----
-----
$ ./unit_test_runner.py --help
usage:
unit_test_runner.py [options] [<file-or-dir>...]
a program to find and run subsets of the relax unit test suite using pyunit.
(details of how to write pyunit tests can be found in your python
distributions
library reference)
arguments:
<file-or-dir> = <file-path> | <dir-path> is a list which can contain
inter-mixed directories and files
<file-path> = a file containing a test case class files of the same
name with the first letter capitalised
e.g. maths_fns/test_chi2.py will be assumed to contain
a test case class called Test_chi2
<dir-path> = a path which will be recursivley searched for <file-path>s
which end in py
options:
-h, --help show this help message and exit
-v, --verbose verbose test ouput
-----
All three systems should have very similar output for the two
conditions - the help system and incorrect usage. An idea would be to
mimic the GNU tools setup. For example incorrect usage of 'ls' gives:
-----
$ ls -e
ls: invalid option -- e
Try `ls --help' for more information.
-----
and:
-----
$ cat -q
cat: invalid option -- q
Try `cat --help' for more information.
-----
We could leave the 'Usage: ...' part when an error occurs though. The
full help can then be returned when the '-h' or '--help' options are
given. What do you think?
Cheers,
Edward