usage-message

Formatting usage messages

时光毁灭记忆、已成空白 提交于 2019-12-03 07:47:48
问题 If you take a look at the Combinatorica package in Mathematica8 in (mathematicapath)/AddOns/LegacyPackages/DiscreteMath/Combinatorica.m you will find the definitions of functions. What I'm interested to know is how Mathematica knows how to format the usage messages. Something tells me that I'm not looking at the right file. In any case, lets try the following: Cofactor::usage = "Cofactor[m, {i, j}] calculates the (i, j)th cofactor of matrix m." This line is the 682 line in the file mentioned

Formatting usage messages

故事扮演 提交于 2019-12-02 21:16:53
If you take a look at the Combinatorica package in Mathematica8 in (mathematicapath)/AddOns/LegacyPackages/DiscreteMath/Combinatorica.m you will find the definitions of functions. What I'm interested to know is how Mathematica knows how to format the usage messages. Something tells me that I'm not looking at the right file. In any case, lets try the following: Cofactor::usage = "Cofactor[m, {i, j}] calculates the (i, j)th cofactor of matrix m." This line is the 682 line in the file mentioned above. Now if we run it in a mathematica notebook and we use ?Cofactor we will see the exact same

Should the command line “usage” be printed on stdout or stderr?

ぃ、小莉子 提交于 2019-11-29 02:08:28
问题 When printing the "usage" of an application, should it be done on stdout or on stderr? Depending on the application I've seen several cases, but there doesn't seem to be one rule. Maybe I'm mistaken and there is one good practice. In that case, what is it? 回答1: Never thought about it, but why not write the usage instructions to stderr if the program was called with no or wrong arguments, and write it to stdout when called with a --help (or similar) argument? This way, if the usage is shown