All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Panic recovery in user callback functions to prevent crashes from user code errors.
- Parser now catches panics in user callback functions (
func(string)andfunc()) and returns them as errors instead of crashing the program (fixes #8).
v1.1.0 - 2025-10-09
Help()now writes to anio.Writer(defaults toos.Stdout) instead of hardcoding standard output.Parse()andParseFrom()now returnErrHelpinstead of callingos.Exit(0)when--helpis requested.- Reworked internal formatting to avoid potential panics with small
StartorStopvalues.
- Restored support for short negations like
-no-c. - Corrected regular expressions for option detection (
--long,-x). - Added bounds checks in
splitOn()to prevent index out of range errors. - Improved handling of
stringsliceandstringmapassignments (no empty entries). - Improved word wrapping and help text formatting for better alignment and safety.
- Prevented duplicate registration of short or long options.
- Maintained backward compatibility with all existing APIs.
- Added internal error
ErrHelpfor easier integration in CLI tools and libraries. - The parser can now be tested without console output by setting
OptionParser.Out.