Badger on the Console

A quick intro to the Task Badger CLI.

Badger in Flowers

Sticking with the theme of the last blog post, we're going to look at how we can use the Task Badger API from the command line, but this time we'll be using the Task Badger CLI instead of cURL.

The Task Badger CLI is a command line tool that allows you to interact with the Task Badger APIs from the command line. It is written in Python and is available as a pip package.


We recommend using pipx to install the CLI since it gives you an isolated environment for the CLI and prevents any dependency conflicts with other Python packages.

$ pipx install taskbadger
$ taskbadger --version
Task Badger CLI Version: x.x.x


The CLI needs to be configured with your Task Badger API token and the organization and project. The simplest way to do this is to use the taskbadger configure command:

$ taskbadger configure

Organization slug: <your organization>
Project slug: <your project>
API Key: <your token>

Config written to ~/.config/taskbadger/config

With that out the way we can start using the CLI. There are two 'modes' in which the CLI may be used, the first gives you a basic interface to create and update tasks which mimics the cURL commands but is easier to use.

With second mode allows you to run shell scripts or command and have the CLI automatically create and update tasks for you.

Basic Usage

$ taskbadger create --name "CLI task"
Task created: 7122sHGxTQw4pr4HoCW3qBjnrV

$ taskbadger update --id 7122sHGxTQw4pr4HoCW3qBjnrV --status processing --value 50

$ taskbadger update --id 7122sHGxTQw4pr4HoCW3qBjnrV --status success --value 100

Other commands include list and get which allow you to list tasks and get the details of a specific task.

Wrapping other commands

This is very useful for tracking the outcome of a command or script that is run automatically. For example, a database backup script that is being run on a schedule.

$ taskbadger run --name "backup" \
  --action error email \
  --capture-output -- /path/to/

Task created:

Notice that you can also specify an action to attach to the task as well as capture the task output.

Consider how much simpler that was than having to write a shell script to communicate with the API.


The Task Badger CLI provides a much simpler way to interact with the API and in particular makes it very easy to track the outcome of scripts and commands.

Next time we'll take a look at the Python SDK.

Subscribe for Updates

Sign up to get notified when we publish new articles.

We don't spam and you can unsubscribe anytime.