commands is a Skiddie-friendly Crystal Shard to make it easier to execute commands.
- Add the dependency to your
shard.yml:
dependencies:
commands:
github: Pr0ngleDev/commands
- Run
shards install
require "commands"execCommand can be used to execute a bash command and receive its output
Crystal.execCommand("Hello World") # Returns Hello WorldexecProscess can be used to execute a bash command and recieve its error code
Crystal.execProcess("echo Hello World") # Returns 0 foo = Crystal.executeCommand("echo foo")
puts foo This would print foo to the stdout
foo = Crystal.executeCommand("echo haha")
puts foo.reverseThis would print ahah to the stdout
- Prongle - creator and maintainer