This diff implements the changes outlined in #50 and more cool stuff; take a look at this example to see what the new syntax looks like. Some highlights:
We don't use decorators anymore! This means that you can use Clipanion from JavaScript without transpilation or alternate syntax, but also that you don't need to enable the legacy decorator syntax in TS.
It also means that your command line types are now completely inferred from your definition, you don't have to write the type anymore (not even the ! / ? markers). There's also no chance that they will accidentally be out of sync with the actual types, as was the case previously (even in our tests!).
I've added initial support for a validator option in Command.String (will soon be added to Command.Array / Command.Rest). This validator is very interesting because it's integrated with Typanion, which now supports coercion. As a result, passing something like t.isNumber into validator will cause the inferred type to become number!
This diff implements the changes outlined in #50 and more cool stuff; take a look at this example to see what the new syntax looks like. Some highlights:
We don't use decorators anymore! This means that you can use Clipanion from JavaScript without transpilation or alternate syntax, but also that you don't need to enable the legacy decorator syntax in TS.
It also means that your command line types are now completely inferred from your definition, you don't have to write the type anymore (not even the
!
/?
markers). There's also no chance that they will accidentally be out of sync with the actual types, as was the case previously (even in our tests!).I've added initial support for a
validator
option inCommand.String
(will soon be added toCommand.Array
/Command.Rest
). This validator is very interesting because it's integrated with Typanion, which now supports coercion. As a result, passing something liket.isNumber
intovalidator
will cause the inferred type to becomenumber
!