Skip to content

Latest commit

 

History

History
84 lines (53 loc) · 1.71 KB

README.md

File metadata and controls

84 lines (53 loc) · 1.71 KB

Shell Task Runner

Simple, lightweight, self-documented task runner for POSIX Shell. Compatible with ash, bash, dash, Linux, Mac OS, alpine, docker.

Usage

You could create shell script e.g. run in your project with code:

task_hello() { ## Print Hello World box
    _box --p=1 --bg-green --bold --white "Hello World! $(_ansi --blue "🌍")"
}

url="https://raw.githubusercontent.com/webuni/shell-task-runner/master/run"
if [ -n "$(command -v 'wget')" ]; then eval "$(wget -qO- "$url")"; else eval "$(curl -s "$url")"; fi

And then you just have to run this file sh ./run.

Helper functions

  • _align

  • _ansi

  • _box

  • _doc_comment

  • _doc_title

  • _docker_run

  • _dotenv

  • _header: Application header.

  • _indent

  • _log

  • _quote

  • _printf_escape

  • _shell_escape

  • _tasks: List of functions with prefix task_.

Report helpers

  • _fail

  • _pass

Customization

If you want to replace a helper functions, you should import runner script and then implement helper function. At the end of the file, you must explicitly call _run:

url="https://raw.githubusercontent.com/webuni/shell-task-runner/master/run"
if [ -n "$(command -v 'wget')" ]; then eval "$(wget -qO- "$url")"; else eval "$(curl -s "$url")"; fi

_header()(
    printf '%s\n\n' "$(_ansi --bold "My application")"
)

_run "$@"

Inspiration