Releases: JordanMarr/FSharp.SystemCommandLine
Support for returning int code from non-task handlers
This release adds built-in support for return an int
status code from synchronous handler functions.
S.CL already supports return Task<int>
from asynchronous handlers, but return a status code from sync handlers requires injecting InvocationContext
into your sync handler and setting the ExitCode
property.
While v0.6.0 added support for injecting dependencies, this release aims to take this use case easier by injecting InvocationContext
behind-the-scenes on the behalf of the user (at the expense of using one of the handler's 16 parameter slots).
See this example of returning a status code.
Dependency Injection
This release adds support for dependency injected inputs in your handler functions via the Input.InjectedDependency
helper method.
See Async App with an Injected CancellationToken example.
Support for returning int code from Task handlers
This release adds the ability to return a Task<int>
status code from your asynchronous command handler functions.
Support for F# Option Type
v0.4.0-alpha
New Features
- Add support for F# option types via
Input.OptionMaybe
andInput.ArgumentMaybe
(See README.md for updated examples) - Added
FSharp.SystemCommandLine.Aliases
module withOpt<'T>
andArg<'T>
convenience aliases forSystem.CommandLine.Option<'T>
andSystem.CommandLine.Argument<'T>
. (This should only be needed if you need to fall back to the core API in the case that a feature is missing from theInput.Option
andInput.Argument
helpers.)
Breaking Changes
- Reworked all
Input.Option
andInput.Argument
overloads that took agetDefaultValue
anonymous function to use adefaultValue
instead. This makes the most common use case much cleaner for F# by removing the anonymous function syntax.
Before:
let words = Input.Option(["--word"; "-w"], (fun () -> Array.empty), "A list of words to be appended")
After:
let words = Input.Option(["--word"; "-w"], Array.empty, "A list of words to be appended")