FSharp.CommandLine 1.0.3025.10813

There is a newer version of this package available.
See the version list below for details.
dotnet add package FSharp.CommandLine --version 1.0.3025.10813                
NuGet\Install-Package FSharp.CommandLine -Version 1.0.3025.10813                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FSharp.CommandLine" Version="1.0.3025.10813" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add FSharp.CommandLine --version 1.0.3025.10813                
#r "nuget: FSharp.CommandLine, 1.0.3025.10813"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install FSharp.CommandLine as a Cake Addin
#addin nuget:?package=FSharp.CommandLine&version=1.0.3025.10813

// Install FSharp.CommandLine as a Cake Tool
#tool nuget:?package=FSharp.CommandLine&version=1.0.3025.10813                

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.

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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,270 6/2/2020
3.2.3671.6874 871 1/20/2020
3.1.3294.2201 1,102 1/8/2019
3.0.3292.28805 745 1/6/2019
3.0.3292.8321 727 1/6/2019
3.0.3291.30511 765 1/5/2019
3.0.3291.28624 738 1/5/2019
2.2.6831.16169 874 9/14/2018
2.1.6831.31891 808 9/14/2018
2.1.6831.31256 744 9/14/2018
2.0.6751.16478 868 6/26/2018
2.0.6744.13276 962 6/19/2018
1.3.6738.175 833 6/13/2018
1.3.6734.15353 963 6/9/2018
1.2.6725.8791 1,020 5/31/2018
1.2.6720.7410 968 5/26/2018
1.1.3059.9094 866 5/18/2018
1.0.3025.21287 1,103 4/14/2018
1.0.3025.10813 1,094 4/14/2018

Initial release.