Skip to content

Commit 999c313

Browse files
committed
Added AcceptLegalFilePathsOnly
1 parent b2ab4f3 commit 999c313

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
@@ -72,6 +72,7 @@ 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`

src/FSharp.SystemCommandLine/Inputs.fs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff 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)

0 commit comments

Comments
 (0)