Skip to content

Releases: JordanMarr/FSharp.SystemCommandLine

Support for returning int code from non-task handlers

08 Apr 15:52
Compare
Choose a tag to compare

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

07 Apr 22:59
Compare
Choose a tag to compare

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

07 Apr 22:57
Compare
Choose a tag to compare

This release adds the ability to return a Task<int> status code from your asynchronous command handler functions.

Support for F# Option Type

24 Mar 04:35
Compare
Choose a tag to compare

v0.4.0-alpha

New Features

  • Add support for F# option types via Input.OptionMaybe and Input.ArgumentMaybe (See README.md for updated examples)
  • Added FSharp.SystemCommandLine.Aliases module with Opt<'T> and Arg<'T> convenience aliases for System.CommandLine.Option<'T> and System.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 the Input.Option and Input.Argument helpers.)

Breaking Changes

  • Reworked all Input.Option and Input.Argument overloads that took a getDefaultValue anonymous function to use a defaultValue 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")