feat: Update free simp
This commit is contained in:
parent
1ab0c6f769
commit
9184f6087c
2 changed files with 42 additions and 9 deletions
|
@ -71,9 +71,42 @@ unsafe def processAllFiles : IO Unit := do
|
|||
println! x
|
||||
| .error _ => println! "Error"
|
||||
|
||||
unsafe def main (args : List String) : IO Unit := do
|
||||
unsafe def processFileArray (files : Array FilePath) : IO Unit := do
|
||||
if files.toList.length = 0 then
|
||||
return ()
|
||||
if files.toList.length = 1 then
|
||||
let path? := files.get? 0
|
||||
match path? with
|
||||
| some path =>
|
||||
transverseTactics path visitTacticInfo
|
||||
return ()
|
||||
| none =>
|
||||
return ()
|
||||
let tasks := files.map fun f =>
|
||||
((IO.asTask $ IO.Process.run
|
||||
{cmd := "lake", args := #["exe", "free_simps","-file", f.toString]}), f)
|
||||
tasks.toList.enum.forM fun (n, (t, path)) => do
|
||||
let tn ← IO.wait (← t)
|
||||
match tn with
|
||||
| .ok x =>
|
||||
if x ≠ "" then
|
||||
println! "{n} of {tasks.toList.length}: {path}"
|
||||
println! x
|
||||
| .error _ => println! "Error"
|
||||
IO.println "Finished!"
|
||||
|
||||
unsafe def argToArrayFilePath (args : List String) : IO (Array FilePath) := do
|
||||
match args with
|
||||
| [path] => transverseTactics path visitTacticInfo
|
||||
| _ =>
|
||||
processAllFiles
|
||||
IO.println "Finished"
|
||||
| ["-file", path] => return #[path]
|
||||
| ["-dir", dir] => do
|
||||
let files ← allFilePaths.go (#[] : Array FilePath) dir (dir : FilePath)
|
||||
return files
|
||||
| [] => do
|
||||
let files ← allFilePaths
|
||||
return files
|
||||
| _ => do
|
||||
panic! "Invalid arguments"
|
||||
|
||||
unsafe def main (args : List String) : IO Unit := do
|
||||
let files ← argToArrayFilePath args
|
||||
processFileArray files
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue