This repo contains sample code to demonstrate existing crystal tools.
It also shows how to create your own tools that relay con crystal compile.
The tool in tool-ivars-count
shows types in a program ordered by the amount of instance variables.
- Install Crystal
- Install llvm
- Ensure llvm-config is in the path or set
LLVM_CONFIG
environment variable - Build the tool
$ make bin/ivars-count
- Use the tool in your codebase
$ bin/ivars-count examples/namespaced-class-declaration.cr
The ivars-count
program takes a filename input (examples/namespaced-class-declaration.cr
in the above example) and compiles it. This means the tool is a Crystal compiler.
In case you want to use crystal HEAD or working copy you can
$ make bin/ivars-count CRYSTAL=path/to/crystal
- ivars-count: types in a program ordered by the amount of instance variables
- top-level: top level symbol names and it's kind
- unused: report unused symbols
- reorder-ivar: reorder ivars from bigger to smaller size in specific types