-
Notifications
You must be signed in to change notification settings - Fork 1
Core Functions
The Core defines functions for bare bash and command executions.
These functions define commands that should be run, any argument will be called through eval
.
Bash line that will be called depending on run checks.
do_run "brew install httpie"
unless_on_path "http"
Bash line that will be called immediately.
run "launctl stop com.some.service"
Run checks will execute and if they return true do_run
will be executed, if not it will be skipped.
Bash line that will return true if the command given fails.
do_run "brew install jq"
unless "[[ -f /usr/local/bin/jq ]]"
Same as unless "[[ -f ARG ]]"
where ARG is the argument given to the function.
do_run "brew install jq"
unless_file "/usr/local/bin/jq"
Same as unless "[[ -d ARG ]]"
where ARG is the argument given to the function.
do_run "mkdir ${HOME}/Projects"
unless_dir "${HOME}/Projects"
Same as unless "type ARG &> /dev/null"
where ARG is the argument given to the function.
do_run "echo 'export PATH=${PATH}:${HOME}/Projects/grind' >> ${HOME}/.bash_profile"
unless_on_path "grind"
Same as unless "[[ -L ARG ]]"
where ARG is the argument given to the function.
do_run "ln -s /this/file /to/symbolic/link"
unless_link "/to/symbolic/link"
Same as unless "pgrep ARG &> /dev/null
where ARG is the argument given to the function.
do_run "service start ssh"
unless_running "sshd"
if_
is the opposite of unless
, it will return true if the command given returns passes.
References another definition to run. The rules for force, dry-run and idempotency still apply. If two different definitions let's say A
and B
refer to a definition C
. C
will execute its commands only once. This should be used carefully as a circular dependency won't be caught by grind
and will loop forever.
It will stop the whole execution if the last command ran failed.