Skip to content

Commit f1d82c7

Browse files
committed
2 parents 459c4d6 + f1648f0 commit f1d82c7

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

README.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,25 @@ open Input
2424
let unzip (zipFile: FileInfo, outputDirMaybe: DirectoryInfo option) =
2525
// Default to the zip file dir if None
2626
let outputDir = defaultArg outputDirMaybe zipFile.Directory
27-
28-
if zipFile.Exists
29-
then printfn $"Unzipping {zipFile.Name} to {outputDir.FullName}"
30-
else printfn $"File does not exist: {zipFile.FullName}"
27+
printfn $"Unzipping {zipFile.Name} to {outputDir.FullName}..."
3128
3229
[<EntryPoint>]
3330
let main argv =
34-
let zipFile = argument "zipfile" |> desc "The file to unzip"
35-
let outputDirMaybe = optionMaybe "--output" |> alias "-o" |> desc "The output directory"
36-
3731
rootCommand argv {
3832
description "Unzips a .zip file"
39-
inputs (zipFile, outputDirMaybe)
33+
inputs (
34+
argument "zipfile"
35+
|> desc "The file to unzip"
36+
|> validate (fun zipFile ->
37+
if zipFile.Exists
38+
then Ok ()
39+
else Error $"File does not exist: {zipFile.FullName}"
40+
),
41+
42+
optionMaybe "--output"
43+
|> alias "-o"
44+
|> desc "The output directory"
45+
)
4046
setAction unzip
4147
}
4248
```

0 commit comments

Comments
 (0)