felixSchl / neodoc

Beautiful, hand-crafted commandline interfaces for node.js
https://felixschl.github.io/neodoc
MIT License
227 stars 9 forks source link

Allow options to have more aliases #64

Closed felixSchl closed 8 years ago

felixSchl commented 8 years ago

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

felixSchl commented 8 years ago

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.

felixSchl commented 8 years ago

Landed via ede0daacd814a9989baec254203408d411aae544