You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+9-8Lines changed: 9 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -141,14 +141,15 @@ config object and remove its invalid properties.
141
141
142
142
## Error Handling
143
143
144
-
By default, nopt outputs a warning to standard error when invalid values for
145
-
known options are found. You can change this behavior by assigning a method
146
-
to `nopt.invalidHandler`. This method will be called with
147
-
the offending `nopt.invalidHandler(key, val, types)`.
148
-
149
-
If no `nopt.invalidHandler` is assigned, then it will console.error
150
-
its whining. If it is assigned to boolean `false` then the warning is
151
-
suppressed.
144
+
By default nopt logs debug messages if `DEBUG_NOPT` or `NOPT_DEBUG` are set in the environment.
145
+
146
+
You can assign the following methods to `nopt` for a more granular notification of invalid, unknown, and expanding options:
147
+
148
+
`nopt.invalidHandler(key, value, type, data)` - Called when a value is invalid for its option.
149
+
`nopt.unknownHandler(key, next)` - Called when an option is found that has no configuration. In certain situations the next option on the command line will be parsed on its own instead of as part of the unknown option. In this case `next` will contain that option.
150
+
`nopt.abbrevHandler(short, long)` - Called when an option is automatically translated via abbreviations.
151
+
152
+
You can also set any of these to `false` to disable the debugging messages that they generate.
0 commit comments