Skip to content

Commit 732957f

Browse files
authored
Updated examples to lock-down input generic types
1 parent 0248cb7 commit 732957f

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ let unzip (zipFile: FileInfo, outputDirMaybe: DirectoryInfo option) =
2929
3030
[<EntryPoint>]
3131
let main argv =
32-
let zipFile = Input.Argument("The file to unzip")
33-
let outputDirMaybe = Input.OptionMaybe(["--output"; "-o"], "The output directory")
32+
let zipFile = Input.Argument<FileInfo>("The file to unzip")
33+
let outputDirMaybe = Input.OptionMaybe<DirectoryInfo>(["--output"; "-o"], "The output directory")
3434
3535
rootCommand argv {
3636
description "Unzips a .zip file"
@@ -68,8 +68,8 @@ let unzip (zipFile: FileInfo, outputDirMaybe: DirectoryInfo option) =
6868
6969
[<EntryPoint>]
7070
let main argv =
71-
let zipFile = Input.Argument("The file to unzip")
72-
let outputDirMaybe = Input.OptionMaybe(["--output"; "-o"], "The output directory")
71+
let zipFile = Input.Argument<FileInfo>("The file to unzip")
72+
let outputDirMaybe = Input.OptionMaybe<DirectoryInfo>(["--output"; "-o"], "The output directory")
7373
7474
rootCommand argv {
7575
description "Unzips a .zip file"
@@ -95,7 +95,7 @@ let listCmd =
9595
then dir.EnumerateFiles() |> Seq.iter (fun f -> printfn "%s" f.Name)
9696
else printfn $"{dir.FullName} does not exist."
9797
98-
let dir = Input.Argument("dir", "The directory to list")
98+
let dir = Input.Argument<DirectoryInfo>("dir", "The directory to list")
9999
100100
command "list" {
101101
description "lists contents of a directory"
@@ -113,8 +113,8 @@ let deleteCmd =
113113
else
114114
printfn $"{dir.FullName} does not exist."
115115
116-
let dir = Input.Argument("dir", "The directory to delete")
117-
let recursive = Input.Option("--recursive", false)
116+
let dir = Input.Argument<DirectoryInfo>("dir", "The directory to delete")
117+
let recursive = Input.Option<bool>("--recursive", false)
118118
119119
command "delete" {
120120
description "deletes a directory"
@@ -183,9 +183,9 @@ let app (cancel: CancellationToken, words: string array, separator: string) =
183183
184184
[<EntryPoint>]
185185
let main argv =
186-
let cancel = Input.InjectedDependency()
187-
let words = Input.Option(["--word"; "-w"], [||], "A list of words to be appended")
188-
let separator = Input.Option(["--separator"; "-s"], ", ", "A character that will separate the joined words.")
186+
let cancel = Input.InjectedDependency<CancellationToken>()
187+
let words = Input.Option<string array>(["--word"; "-w"], [||], "A list of words to be appended")
188+
let separator = Input.Option<string>(["--separator"; "-s"], ", ", "A character that will separate the joined words.")
189189
190190
rootCommand argv {
191191
description "Appends words together"
@@ -219,8 +219,8 @@ let app (svc: WordService) (words: string array, separator: string) =
219219
220220
[<EntryPoint>]
221221
let main argv =
222-
let words = Input.Option(["--word"; "-w"], Array.empty, "A list of words to be appended")
223-
let separator = Input.Option(["--separator"; "-s"], ", ", "A character that will separate the joined words.")
222+
let words = Input.Option<string array>(["--word"; "-w"], Array.empty, "A list of words to be appended")
223+
let separator = Input.Option<string>(["--separator"; "-s"], ", ", "A character that will separate the joined words.")
224224
225225
// Initialize app dependencies
226226
let svc = WordService()

0 commit comments

Comments
 (0)