A shell-script driven task runner.
cargo install --force runme
Download from Github Releases, unzip and add runme to your $PATH.
extractions/setup-crate can be used to install just in a GitHub Actions workflow.
yaml
- uses: extractions/setup-crate@v1
with:
owner: sigoden
name: runme
First, run runme --runme-create build test
to quickly create boilerplate Runmefile.sh
```sh
set -e
build() { echo Run build }
test() { echo Run test }
eval $(runme --runme-eval "$0" "$@") ```
To define a new task, simply create the bash function and add the
@cmd
above it. Task is just function
Then, try running one of your commands!
$ runme build
Run build
$ runme test
Run test
Runme uses
argc
to parse Runmefile.
runme
provides a cross platform way to define and execute custom commands specific to a codebase.
The less work you have to do when performing repetitive tasks like building, testing, linting, etc, the easier your job becomes. After you've configured it through a Runmefile.sh
, a task runner can do most of that mundane work for you—and your team—with basically zero effort.
runme
binary is available in linux, macos, and windows.
runme
depends on bash which already built into linux/macos. In windows, runme automatically locates and uses bash that comes with git by default.
Gnu tools like ls
, rm
, grep
, sed
, awk
... also provided with bash, so you can uses them freely and confidently in the Runmefile.
Tasks can be listed with runme --help
or runme -h
.
```
$ runme --help
USAGE: Runmefile.sh
COMMANDS: build build project [aliases: b] test test project ```
runme <task> --help
or runme <task> -h
will print a help text containing the description of task's flags, options and positional arguments.
Parameters can be accessed using shell variables
```sh
run() {
echo $2 $1 $#
}
$ runme run foo bar
bar foo 2
```
A more powerful way to define parameters is to use comment tags: @arg
, @option
and @flag
.
```sh
download() { echo "cmd: download" echo "flag: --force $argcforce" echo "option: --tries $argctries" echo "arg: source $argcsource" echo "arg: target $argctarget" } ```
``` Download a file
USAGE: Runmefile.sh download [OPTIONS]
ARGS:
OPTIONS:
-f, --force Override existing file
-t, --tries
$ runme download -f --tries 3 from.txt to.txt
cmd: download
flag: --force 1
option: --tries 3
arg: source from.txt
arg: target to.txt
```sh
test() { echo "Test..." } ```
$ runme t
Test...
Dependencies are established by function calling.
```sh
bar() { foo; echo bar baz; }
foo() { echo foo }
baz() { echo baz } ```
$ runme bar
foo
bar
baz
Tasks can be semantically grouped with _
, -
, @
, .
, :
.
```sh
test@unit() {}
test@bin() {}
app.build() {}
app.test() {} ```
When runme
is invoked without a task name, it runs the main
function.
If the main
function does not exist, runme will print help information.
```sh main() { foo }
foo() { echo foo } ```
$ runme
foo
Shell completion scripts are available for bash/zsh/powershell.
You can use environment variable RUNME_SHELL
to customize shell path.
RUNME_SHELL="C:\\Program Files\\Git\\bin\\bash.exe"
By default, runme searches for runme script file of the following:
You can use environment variable RUNME_SCRIPT
to custom script name.
RUNME_SCRIPT=taskfile.sh
Copyright (c) 2022 runme-developers.
runme is made available under the terms of either the MIT License or the Apache License 2.0, at your option.
See the LICENSE-APACHE and LICENSE-MIT files for license details.