Skip to content
hareharePublic

About

A task runner that executes code blocks in Markdown files based on section titles.

Topics

Resources

Stars

17 stars

Watchers

0 watching

Forks

Latest commit

 

History

380 Commits

Folders and files

Repository files navigation

mq-task is a task runner that executes code blocks in Markdown files based on section titles. It is implemented using mq, a jq-like command-line tool for Markdown processing, to parse and extract sections from Markdown documents.

demo

Warning

mq-task is currently under active development.

Features

Installation

curl -sSL https://task.mqlang.org/install.sh | bash

or with Cargo:

cargo install --git https://github.com/harehare/mq-task.git

Usage

A task is a heading followed by code blocks. A meta block (TOML) adds options such as dependencies, parameters or conditions:

## build

Compile the project.

```bash
cargo build --release
```

## test

```meta
depends = ["build"]
sources = ["src/**/*.rs", "tests/**/*.rs"]  # skipped when unchanged
retries = 2
```

```bash
cargo test
```

## deploy

```meta
params = ["env=staging", "region"]   # name=default; a bare name is required
depends = ["test"]
prompt = "Deploy?"
if = 'flag("CI") || which("kubectl")'
```

```bash
./deploy.sh "$MX_PARAM_ENV" "$MX_PARAM_REGION"
```

## ci

```meta
depends = ["lint", "test", "build"]
parallel = true
```

```bash
echo "all checks passed"
```

## report

Code blocks can use any language with a runtime.

```python
print("report generated")
```
mq-task                          # list tasks from tasks.md, else README.md
mq-task build                    # run a task (and its dependencies first)
mq-task deploy -- region=eu      # named parameters; positional args also work
mq-task ci -j 4                  # run dependencies in parallel
mq-task test --watch             # re-run when sources change
mq-task -f docs/dev.md           # use another file
mq-task init                     # write a starter tasks.md

Documentation

License

MIT

About

A task runner that executes code blocks in Markdown files based on section titles.

Topics

Resources

Stars

17 stars

Watchers

0 watching

Forks

Releases

Used by

Contributors

Languages