A CLI that allows to use Crystal as a scripting language by caching build artefacts.
- Crystal 100%
| LICENSES | Proof of Concept | |
| spec | 0.3.1 Refactoring + minor improvements | |
| src | 0.3.1 Refactoring + minor improvements | |
| .gitignore | Add SQLite-based cache manifest with cache management commands | |
| README.md | Update README.md | |
| shard.lock | Add SQLite-based cache manifest with cache management commands | |
| shard.yml | 0.3.1 Refactoring + minor improvements | |
CrystalScript
A CLI that allows using Crystal as a scripting language by caching compiled binaries.
Install
shards build --production && mv bin/crystalscript ~/.local/bin/crystalscript
Usage
Run any Crystal script directly:
crystalscript my_script.cr
Make scripts executable with a shebang:
#!/usr/bin/env crystalscript
puts "Hello!"
Then:
chmod +x my_script.cr
./my_script.cr
Compilation Modes
You can specify different compilation modes with the -m/--mode argument.
normal is the default, it will produce an optimized binary with debug symbols.
#!/usr/bin/env crystalscript
## or
#!/usr/bin/env -S crystalscript --mode normal
release will compile an optimized binary without debug symbols, resulting in a much lighter binary.
Use it if you don't need the debug symbols and you want the cached binary to take as less space as possible.
#!/usr/bin/env -S crystalscript --mode release
dev will optimize for compilation speed, with debug symbols, resulting in a heavy binary.
Use it when you want to iterate faster when developing your script.
#!/usr/bin/env -S crystalscript --mode dev
More info about the usage of -S in the shebang line