File tree Expand file tree Collapse file tree 1 file changed +14
-8
lines changed
Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -24,19 +24,25 @@ open Input
2424let 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>]
3330let 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```
You can’t perform that action at this time.
0 commit comments