FSharp.CommandLine
1.0.3025.21287
See the version list below for details.
dotnet add package FSharp.CommandLine --version 1.0.3025.21287
NuGet\Install-Package FSharp.CommandLine -Version 1.0.3025.21287
<PackageReference Include="FSharp.CommandLine" Version="1.0.3025.21287" />
paket add FSharp.CommandLine --version 1.0.3025.21287
#r "nuget: FSharp.CommandLine, 1.0.3025.21287"
// Install FSharp.CommandLine as a Cake Addin #addin nuget:?package=FSharp.CommandLine&version=1.0.3025.21287 // Install FSharp.CommandLine as a Cake Tool #tool nuget:?package=FSharp.CommandLine&version=1.0.3025.21287
FSharp.CommandLine
The FSharp.CommandLine library can be installed from NuGet
PM> Install-Package FSharp.CommandLine
FSharp.CommandLine is a monadic commandline application framework that automatically generates both help texts and shell suggestions.
This library also contains type-safe scanf and type-safe commandline option parser.
Example
open System
open FSharp.CommandLine
open FSharp.CommandLine.Options
open FSharp.CommandLine.Commands
let fileOption =
commandOption {
names ["f"; "file"]
description "Name of a file to use (Default index: 0)"
takes (format("%s:%i").withNames ["filename"; "index"])
takes (format("%s").map (fun filename -> (filename, 0)))
suggests (fun _ -> [CommandSuggestion.Files None])
}
type Verbosity = Quiet | Normal | Full | Custom of int
let verbosityOption =
commandOption {
names ["v"; "verbosity"]
description "Display this amount of information in the log."
takes (regex @"q(uiet)?$" |> asConst Quiet)
takes (regex @"n(ormal)?$" |> asConst Quiet)
takes (regex @"f(ull)?$" |> asConst Full)
takes (format("custom:%i").map (fun level -> Custom level))
takes (format("c:%i").map (fun level -> Custom level))
}
let mainCommand () =
command {
name "main"
description "The main command."
let! files = fileOption |> CommandOptionUtils.zeroOrMore
let! verbosity = verbosityOption |> CommandOptionUtils.zeroOrExactlyOne
|> CommandOptionUtils.whenMissingUse Normal
preprocess
do printfn "%A, %A" files verbosity
return 0
}
[<EntryPoint>]
let main argv =
mainCommand() |> Command.runAsEntryPoint argv
Samples & documentation
The library comes with comprehensible documentation.
It can include tutorials automatically generated from *.fsx
files in the content folder.
The API reference is automatically generated from Markdown comments in the library implementation.
Tutorial contains a further explanation of this sample library.
API Reference contains automatically generated documentation for all types, modules and functions in the library. This includes additional brief samples on using most of the functions.
Contributing and copyright
The project is hosted on GitHub where you can report issues, fork the project and submit pull requests. If you're adding a new public API, please also consider adding samples that can be turned into a documentation. You might also want to read the library design notes to understand how it works.
The library is available under Public Domain license, which allows modification and redistribution for both commercial and non-commercial purposes. For more information see the License file in the GitHub repository.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net45 is compatible. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
-
- FSharp.Core (>= 0.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
3.3.3805.29705 | 1,027 | 6/2/2020 |
3.2.3671.6874 | 864 | 1/20/2020 |
3.1.3294.2201 | 1,095 | 1/8/2019 |
3.0.3292.28805 | 738 | 1/6/2019 |
3.0.3292.8321 | 720 | 1/6/2019 |
3.0.3291.30511 | 758 | 1/5/2019 |
3.0.3291.28624 | 731 | 1/5/2019 |
2.2.6831.16169 | 856 | 9/14/2018 |
2.1.6831.31891 | 796 | 9/14/2018 |
2.1.6831.31256 | 732 | 9/14/2018 |
2.0.6751.16478 | 857 | 6/26/2018 |
2.0.6744.13276 | 951 | 6/19/2018 |
1.3.6738.175 | 822 | 6/13/2018 |
1.3.6734.15353 | 952 | 6/9/2018 |
1.2.6725.8791 | 1,007 | 5/31/2018 |
1.2.6720.7410 | 957 | 5/26/2018 |
1.1.3059.9094 | 855 | 5/18/2018 |
1.0.3025.21287 | 1,092 | 4/14/2018 |
1.0.3025.10813 | 1,083 | 4/14/2018 |
Initial release.