Skip to content

Instantly share code, notes, and snippets.

@tvalladon
Last active July 15, 2019 21:12
Show Gist options
  • Save tvalladon/f8b60b63e0912cf1d570e4749ed33ec5 to your computer and use it in GitHub Desktop.
Save tvalladon/f8b60b63e0912cf1d570e4749ed33ec5 to your computer and use it in GitHub Desktop.
Simple bash helper
#!/bin/bash
PATH=./node_modules/.bin:$PATH
function debug() {
echo "Stopped in REPL. Press ^D to resume, or ^C to abort."
local line
while read -r -p "> " line; do
eval "$line"
done
echo
}
function example { ## An example function
echo "You selected example with args of : " $*
}
function help { ## Display usage for this application
grep -E '^function [a-zA-Z_-]+ {.*?## .*$$' $0 | sed -e 's/function //' | sort | awk 'BEGIN {FS = "{.*?## "}; {printf "\033[93m%-30s\033[92m %s\033[0m\n", $1, $2}'
}
function default {
help
}
TIMEFORMAT="Task completed in %3lR"
time "${@:-default}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment