You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+22-17Lines changed: 22 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
### FSharp.SystemCommandLine 
1
+
### FSharp.SystemCommandLine [](https://www.nuget.org/packages/FSharp.SystemCommandLine/)
2
2
3
3
The purpose of this library is to improve type safety when using the `System.CommandLine` API in F# by utilizing computation expression syntax.
4
4
@@ -19,32 +19,37 @@ The purpose of this library is to improve type safety when using the `System.Com
19
19
20
20
```F#
21
21
open FSharp.SystemCommandLine
22
+
open System.IO
23
+
24
+
let unzip (zipFile: FileInfo, outputDir: DirectoryInfo) =
25
+
// Default to the zip file dir if null
26
+
let outputDir =
27
+
outputDir
28
+
|> Option.ofObj
29
+
|> Option.defaultValue zipFile.Directory
22
30
23
-
let app (words: string array, separator: string) =
24
-
System.String.Join(separator, words)
25
-
|> printfn "Result: %s"
31
+
if zipFile.Exists
32
+
then printfn $"Unzipping {zipFile.Name} to {outputDir.FullName}"
33
+
else printfn $"File does not exist: {zipFile.FullName}"
26
34
27
35
[<EntryPoint>]
28
36
let main argv =
29
-
let words = Input.Option(["--word"; "-w"], (fun () -> Array.empty<string>), "A list of words to be appended")
30
-
let separator = Input.Option(["--separator"; "-s"], (fun () -> ","), "A character that will separate the joined words.")
37
+
let zipFile = Input.Argument<FileInfo>("The file to unzip")
38
+
let outputDir = Input.Option<DirectoryInfo>("-o", (fun () -> null), "The output directory")
0 commit comments