File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
src/FSharp.SystemCommandLine Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -72,11 +72,13 @@ The new `Input` module contains functions for the underlying System.CommandLine
7272* ` optionMaybe ` creates a named ` Option<'T option> ` that defaults to ` None ` .
7373
7474### Input Properties
75+ * ` acceptLegalFilePathsOnly ` sets the option or argument to accept only values representing legal file paths.
7576* ` alias ` adds an ` Alias ` to an ` Option `
7677* ` aliases ` adds one or more aliases to an ` Option `
7778* ` desc ` adds a description to an ` Option ` or ` Argument `
7879* ` defaultValue ` or ` def ` provides a default value to an ` Option ` or ` Argument `
7980* ` defFactory ` assigns a default value factor to an ` Option ` or ` Argument `
81+ * ` helpName ` adds the name used in help output to describe the option or argument.
8082* ` required ` marks an ` Option ` as required
8183* ` validate ` allows you to return a ` Result<unit, string> ` for the parsed value
8284* ` validateFileExists ` ensures that the ` FileInfo ` exists
Original file line number Diff line number Diff line change @@ -68,6 +68,12 @@ module Input =
6868 | _ -> ()
6969 input
7070
71+ /// Configures the option or argument to accept only values representing legal file paths.
72+ let acceptLegalFilePathsOnly ( input : ActionInput < 'T >) =
73+ input
74+ |> editOption ( fun o -> o.AcceptLegalFilePathsOnly() |> ignore)
75+ |> editArgument ( fun a -> a.AcceptLegalFilePathsOnly() |> ignore)
76+
7177 /// Adds one or more aliases to an option.
7278 let aliases ( aliases : string seq ) ( input : ActionInput < 'T >) =
7379 input |> editOption ( fun o -> aliases |> Seq.iter o.Aliases.Add)
@@ -100,6 +106,12 @@ module Input =
100106 |> editOption ( fun o -> o.DefaultValueFactory <- defaultValueFactory)
101107 |> editArgument ( fun a -> a.DefaultValueFactory <- defaultValueFactory)
102108
109+ /// The name used in help output to describe the option or argument.
110+ let helpName ( helpName : string ) ( input : ActionInput < 'T >) =
111+ input
112+ |> editOption ( fun o -> o.HelpName <- helpName)
113+ |> editArgument ( fun a -> a.HelpName <- helpName)
114+
103115 /// Marks an option as required.
104116 let required ( input : ActionInput < 'T >) =
105117 input |> editOption ( fun o -> o.Required <- true )
You can’t perform that action at this time.
0 commit comments