src/Pure/Tools/update_theorems.scala
changeset 62836 98dbed6cfa44
parent 62454 38c89353b349
child 68994 d961e11e0e87
equal deleted inserted replaced
62835:1a9ce1b13b20 62836:98dbed6cfa44
    27       File.write_backup2(path, text1)
    27       File.write_backup2(path, text1)
    28     }
    28     }
    29   }
    29   }
    30 
    30 
    31 
    31 
    32   /* command line entry point */
    32   /* Isabelle tool wrapper */
    33 
    33 
    34   def main(args: Array[String])
    34   val isabelle_tool = Isabelle_Tool("update_theorems", "update toplevel theorem keywords", args =>
    35   {
    35   {
    36     Command_Line.tool0 {
    36     val getopts = Getopts("""
    37       val getopts = Getopts("""
       
    38 Usage: isabelle update_theorems [FILES|DIRS...]
    37 Usage: isabelle update_theorems [FILES|DIRS...]
    39 
    38 
    40   Recursively find .thy files and update toplevel theorem keywords:
    39   Recursively find .thy files and update toplevel theorem keywords:
    41 
    40 
    42     theorems             ~>  lemmas
    41     theorems             ~>  lemmas
    45     schematic_corollary  ~>  schematic_goal
    44     schematic_corollary  ~>  schematic_goal
    46 
    45 
    47   Old versions of files are preserved by appending "~~".
    46   Old versions of files are preserved by appending "~~".
    48 """)
    47 """)
    49 
    48 
    50       val specs = getopts(args)
    49     val specs = getopts(args)
    51       if (specs.isEmpty) getopts.usage()
    50     if (specs.isEmpty) getopts.usage()
    52 
    51 
    53       for {
    52     for {
    54         spec <- specs
    53       spec <- specs
    55         file <- File.find_files(Path.explode(spec).file, file => file.getName.endsWith(".thy"))
    54       file <- File.find_files(Path.explode(spec).file, file => file.getName.endsWith(".thy"))
    56       } update_theorems(Path.explode(File.standard_path(file)))
    55     } update_theorems(Path.explode(File.standard_path(file)))
    57     }
    56   })
    58   }
       
    59 }
    57 }