Skip to content

Commit b2ab4f3

Browse files
committed
Added HelpName
1 parent aa1df1b commit b2ab4f3

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ The new `Input` module contains functions for the underlying System.CommandLine
7777
* `desc` adds a description to an `Option` or `Argument`
7878
* `defaultValue` or `def` provides a default value to an `Option` or `Argument`
7979
* `defFactory` assigns a default value factor to an `Option` or `Argument`
80+
* `helpName` adds the name used in help output to describe the option or argument.
8081
* `required` marks an `Option` as required
8182
* `validate` allows you to return a `Result<unit, string>` for the parsed value
8283
* `validateFileExists` ensures that the `FileInfo` exists

src/FSharp.SystemCommandLine/Inputs.fs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,12 @@ module Input =
100100
|> editOption (fun o -> o.DefaultValueFactory <- defaultValueFactory)
101101
|> editArgument (fun a -> a.DefaultValueFactory <- defaultValueFactory)
102102

103+
/// The name used in help output to describe the option or argument.
104+
let helpName (helpName: string) (input: ActionInput<'T>) =
105+
input
106+
|> editOption (fun o -> o.HelpName <- helpName)
107+
|> editArgument (fun a -> a.HelpName <- helpName)
108+
103109
/// Marks an option as required.
104110
let required (input: ActionInput<'T>) =
105111
input |> editOption (fun o -> o.Required <- true)

0 commit comments

Comments
 (0)