felixSchl/neodoc

Allow options to have more aliases

felixSchl opened this issue · 2 comments

Instead of

type Option = { name :: Maybe String, flag :: Maybe Char | ... }

it could be

data Alias = Long String | Short Char
type Option = { aliases :: NonEmpty Alias | ... }

This would allow to do things like -h, -?, --help

This work is almost complete and it really showed the strength of the type system. After swapping over it revealed many edge cases that had either no been dealt with at all or had been dealt with in a awkward way, since two Maybes do not guarantee that one them will be a Just.

Landed via ede0daa