PhysLean/scripts/MetaPrograms/redundent_imports.lean

32 lines
746 B
Text
Raw Normal View History

2024-12-20 16:46:11 +00:00
/-
Copyright (c) 2024 Joseph Tooby-Smith. All rights reserved.
Released under Apache 2.0 license.
Authors: Joseph Tooby-Smith
-/
2025-02-14 08:50:24 +00:00
import PhysLean.Meta.Basic
2024-12-20 16:46:11 +00:00
import ImportGraph.Imports
2025-03-20 05:02:38 -04:00
import Mathlib.Lean.CoreM
2024-12-20 16:46:11 +00:00
/-!
# Extracting commands with no doc strings.
-/
2025-02-14 08:50:24 +00:00
open Lean System Meta PhysLean
2024-12-20 16:46:11 +00:00
def Imports.RedundentImports (imp : Import) : MetaM UInt32 := do
let x ← redundantImports (some imp.module)
if x.isEmpty then return 0
println! "\n"
2025-03-20 05:02:38 -04:00
println! (Name.toFilePath imp.module)
2024-12-20 16:46:11 +00:00
println! x.toList
return 0
unsafe def main (_ : List String) : IO UInt32 := do
initSearchPath (← findSysroot)
let imports ← allImports
2025-02-14 08:50:24 +00:00
let _ ← CoreM.withImportModules #[`PhysLean] (imports.mapM Imports.RedundentImports).run'
2024-12-20 16:46:11 +00:00
return 0