Skip to content

Simple, lightweight, self-documented task runner for Shell.

License

Notifications You must be signed in to change notification settings

webuni/shell-task-runner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Releases

No releases published

Packages

No packages published

Languages