-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Description
Currently this library does not have good error messages by default. For example, the example program:
const getopt = require('node-getopt');
const info = getopt.create([
['t', 'test=ARG', 'Test']
]).bindHelp().parseSystem();This has a few problems that result in poor error messages:
- Using it as
./example.js --testresults in:option test need argument; The argument I used is "--test" not "test", this is what should be reported to the user. This is what GNU "ls" returns:ls: option '--format' requires an argument - Using it as
./example -tresults in:option test need argument; The argument I used is "-t" not "test" (or even "--test"), this is what should be reported to the user. This is what GNU "ls" returns:ls: option requires an argument -- 'I'
Further, there is no capability to fix this without modifying the library because the error() method is passed in an Error object with a string as its error, which does not contain enough information to determine what the error should actually be. This is poor extensibility.
Metadata
Metadata
Assignees
Labels
No labels