File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
src/FSharp.SystemCommandLine Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,16 @@ module Input =
9494 /// An alias for ` defaultValue ` to set the default value of an option or argument.
9595 let def = defaultValue
9696
97+ /// Sets the default value of an option or argument.
98+ let defaultValueMaybe ( defaultValue : 'T option ) ( input : ActionInput < 'T >) =
99+ match defaultValue with
100+ | Some defaultValue' ->
101+ input
102+ |> editOption ( fun o -> o.DefaultValueFactory <- ( fun _ -> defaultValue'))
103+ |> editArgument ( fun a -> a.DefaultValueFactory <- ( fun _ -> defaultValue'))
104+ | None ->
105+ input
106+
97107 /// Sets the default value factory of an option or argument.
98108 let defaultValueFactory ( defaultValueFactory : Parsing.ArgumentResult -> 'T ) ( input : ActionInput < 'T >) =
99109 input
You can’t perform that action at this time.
0 commit comments