@@ -64,23 +64,32 @@ _Notice that mismatches between the `setAction` and the `inputs` are caught as a
6464
6565## Input API
6666The new ` Input ` module contains functions for the underlying System.CommandLine ` Option ` and ` Argument ` properties.
67+ ### Inputs
6768* ` context ` passes an ` ActionContext ` containing a ` ParseResult ` and ` CancellationToken ` to the action
6869* ` argument ` creates a named ` Argument<'T> `
6970* ` argumentMaybe ` creates a named ` Argument<'T option> ` that defaults to ` None ` .
7071* ` option ` creates a named ` Option<'T> `
7172* ` optionMaybe ` creates a named ` Option<'T option> ` that defaults to ` None ` .
73+
74+ ### Input Properties
75+ * ` acceptLegalFilePathsOnly ` sets the option or argument to accept only values representing legal file paths.
7276* ` alias ` adds an ` Alias ` to an ` Option `
7377* ` aliases ` adds one or more aliases to an ` Option `
7478* ` desc ` adds a description to an ` Option ` or ` Argument `
7579* ` defaultValue ` or ` def ` provides a default value to an ` Option ` or ` Argument `
7680* ` 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.
7782* ` required ` marks an ` Option ` as required
7883* ` validate ` allows you to return a ` Result<unit, string> ` for the parsed value
7984* ` validateFileExists ` ensures that the ` FileInfo ` exists
8085* ` validateDirectoryExists ` ensures that the ` DirectoryInfo ` exists
8186* ` addValidator ` allows you to add a validator to the underlying ` Option ` or ` Argument `
87+ * ` acceptOnlyFromAmong ` validates the allowed values for an ` Option ` or ` Argument `
8288* ` customParser ` allows you to parse the input tokens using a custom parser function.
8389* ` tryParse ` allows you to parse the input tokens using a custom parser ` Result<'T, string> ` function.
90+ * ` arity ` sets the arity of an ` Option ` or ` Argument `
91+ * ` allowMultipleArgumentsPerToken ` allows multiple values for an ` Option ` or ` Argument ` . (Defaults to 'false' if not set.)
92+ * ` hidden ` hides an option or argument from the help output
8493* ` editOption ` allows you to pass a function to edit the underlying ` Option `
8594* ` editArgument ` allows you to pass a function to edit the underlying ` Argument `
8695* ` ofOption ` allows you to pass a manually created ` Option `
@@ -402,14 +411,14 @@ module Global =
402411
403412 type Options = { EnableLogging: bool; LogFile: FileInfo }
404413
405- let options: HandlerInput seq = [ enableLogging; logFile ]
414+ let options: ActionInput seq = [ enableLogging; logFile ]
406415
407416 let bind (ctx: ActionContext) =
408417 { EnableLogging = enableLogging.GetValue ctx.ParseResult
409418 LogFile = logFile.GetValue ctx.ParseResult }
410419
411420let listCmd =
412- let action (ctx: InvocationContext , dir: DirectoryInfo) =
421+ let action (ctx: ActionContext , dir: DirectoryInfo) =
413422 let options = Global.bind ctx
414423 if options.EnableLogging then
415424 printfn $"Logging enabled to {options.LogFile.FullName}"
@@ -431,7 +440,7 @@ let listCmd =
431440 }
432441
433442let deleteCmd =
434- let action (ctx: InvocationContext , dir: DirectoryInfo, recursive: bool) =
443+ let action (ctx: ActionContext , dir: DirectoryInfo, recursive: bool) =
435444 let options = Global.bind ctx
436445 if options.EnableLogging then
437446 printfn $"Logging enabled to {options.LogFile.FullName}"
@@ -462,7 +471,7 @@ let ioCmd =
462471 }
463472
464473[<EntryPoint>]
465- let main argv =
474+ let main ( argv: string array) =
466475 let cfg =
467476 commandLineConfiguration {
468477 description "Sample app for System.CommandLine"
0 commit comments