Add the dependency to your shard.yml
:
dependencies:
spark:
github: stephendolan/spark
Run shards install
Require the shard:
require "spark"
Then, use any of the fully documented modules below to interact with your user:
- ⚡️ Spark
.indent
- Increase indentation for all Spark output by one level.outdent
- Decrease indentation for all Spark output by one level.reset_indentation
- Set the indentation level for all Spark output back to zero
- 💬 Spark::Prompt
- 📄 Spark::Template
.run_remote_file
- Run Crystal code from a remote source (USE WITH CAUTION).run_local_file
- Run Crystal code from a local file source (USE WITH CAUTION)
- 🗄 Spark::File
.replace_in_file
- Replace some content in a file.inject_into_file
- Insert content into a file before or after a pattern.prepend_to_file
- Insert content at the beginning of a file.append_to_file
- Insert content at the end of a file.copy_file
- Copy a file (very few safeguards in place currently).move_file
- Move a file (very few safeguards in place currently).create_file
- Create a file (very few safeguards in place currently).remove_file
- Remove a file.chmod_file
- Change the permissions of a file
- 💎 Spark::Shard
#add_shard
- Adds a shard to theshard.yml
file
Spark ships with a command line interface, installed in a postinstall
step when you shards install
. The resulting binary will be located at ./bin/spark
.
With this CLI installed, you have access to the following commands:
./bin/spark apply [Remote Template URL]
- Runs the content returned from the provided URL throughcrystal run
./bin/spark apply --local [Local File Path]
- Runs the content of the provided file path throughcrystal run
- Add your code
- Ensure specs pass with
crystal spec
- Ensure correct formatting with
crystal tool format --check
- Ensure correct style with
./bin/ameba
- Fork it (https://github.com/stephendolan/spark/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
- TTY because of the excellent code and organization
- Thor because I've loved using it with Ruby and Rails
- Ameba because of their excellent shard CLI
- Stephen Dolan - creator and maintainer