jimtcl
jimtcl copied to clipboard
Inconsistent error messages
string z => "bad option "z": must be bytelength, ... , or trimright" info z => "bad subcommand "z": must be alias, ... , or version" file z => "file, unknown command "z": should be atime, ... , isfile" If a cmd with subcmds is created in C: cmd z => "cmd, ambiguous command "z": should be something, ..., other"
Which form should I use for my programs?
Tcl 8.6 does seems to be moving to towards standardising on "unknown or ambiguous subcommand ...", thus not differentiating between unknown and ambiguous, so that is a reasonable choice.
Although there are still situations where other wording is used.
% lsort -xxx z bad option "-xxx":
% interp z bad option "z":
#194 harmonizes some error messages related to lsearch and lsort with Tcl 8.7.
The https://github.com/msteveb/jimtcl/tree/cmd-register branch resolves this by consistently using JimCmdUsage() to report usage errors.
Welcome to Jim version 0.82
. string z
string, unknown command "z": should be bytelength, byterange, cat, compare, equal, first, index, is, last, length, map, match, range, repeat, replace, reverse, tolower, totitle, toupper, trim, trimleft, trimright
[error] . info z
info, unknown command "z": should be alias, args, body, channels, commands, complete, exists, frame, globals, help, hostname, level, locals, nameofexecutable, patchlevel, procs, references, returncodes, script, source, stacktrace, statics, tainted, usage, vars, version
[error] . file z
file, unknown command "z": should be atime, copy, delete, dirname, executable, exists, extension, isdirectory, isfile, join, link, lstat, mkdir, mtime, mtimeus, normalize, owned, readable, readlink, rename, rootname, size, split, stat, tail, tempfile, type, writable