Skip to main content
taskr
  1. projects/

taskr

Table of Contents

taskr is a simple command-line task runner written in C++. It allows you to define tasks in a taskrfile and execute them with ease. It also supports loading environment variables from defined environment files.

CLI
#

$ taskr -h
Usage:
  taskr <task_name> [options]

Options:
  -h, --help         Show this help message and exit
  -l, --list         List the available tasks
  -e, --environment  Select the environment you want to use
  -s, --silent       Silence all output (all tasks)
  -v, --verbose      Print all output (all tasks)

taskr will look for a taskrfile file in the current directory.

Set alias t=taskr in your shell to use fewer keystrokes!

Configuration
#

Environments
#

Header:

env <name>:

Keys:

  • file: which file’s env variables need to be loaded for this specific environment.

Default Environment
#

The default environment is loaded when you do not explicitly provide an environment using -e. Using -e overrides this. Header:

default env <name>:

Keys:

  • file: which file’s env variables need to be loaded for this specific environment.

Task
#

Header:

task <name>:

Keys:

  • run: The command that the task will execute. This is the only required key.
  • desc: The description of the task.
  • needs: The dependencies of the task, dependencies will run in the order you defined.
  • alias: List of aliases that can be used to run the task.

If a name of a task starts with _, it is treated as a hidden task, this means that it will not show up in the --list output. Its output will also not be printed by default.

Example Configuration
#

// default environment, will get loaded even without -e flag
default env dev:
  file = .env

task echo:
  run = echo "$GREETING"

Example .env file:

GREETING="Hello World!"

Example execution using the dev environment:

$ taskr echo
Hello World!

More repos
#

To support writing taskrfiles, I’m creating a tree-sitter parser for highlighting and an LSP Implementation for it’s confituration language.

All repositories are found under the taskr organization.