Skip to content

Taskfile schema ​

Every key hobnob reads, as tables. Each row links to the guide page that explains it.

yaml
const: # fixed values, nothing outside the file can override
  - API: https://the-trivia-api.com/v2

vars: # overridable defaults
  - CATEGORY: general_knowledge

env: # files to source
  - .env

modules: # imported hobnob files
  - report: ./reporting.yml

tasks:
  ask-trivia:
    steps:
      - run: curl -s "{{.API}}/questions?limit=1&categories={{.CATEGORY}}"

Top level ​

All five keys are optional.

KeyHoldsGuide
const:Fixed values; nothing outside the file overrides.Variables
vars:Overridable defaults.Variables
env:Files to source.Env files
modules:Imported hobnob files.Modules
tasks:The tasks, by name. A _ prefix makes one internal.Tasks

Tasks ​

KeyMeaningGuide
info:One-line description, shown in --list and the picker.Tasks
steps:The sequence to run.Tasks
if:Shell condition; non-zero skips the whole task.Conditions
dir:Working directory for the task's run: steps.Working directory
once:Memoize: run at most once per invocation.Running once
results:Variables a call: without into: hands back.Calling tasks

Steps ​

A step names exactly one kind, and takes only that kind's keys. Every kind also takes if:.

KindKeys besides if:Guide
set:noneVariables
run:into:, dir:, soft:, quiet:Running commands
get:nonePrompts
call:with:, into:, dir:, soft:Calling tasks
loop:steps:Loops

set: entries ​

FormMeaning
- NAME: valueA template, a bare reference or a literal.
- NAME: { value: …, secret: true }Same, masked wherever hobnob shows it.

const: and vars: entries take the same forms. See Secrets.

run: keys ​

KeyMeaningGuide
into:Capture stdout, stderr or exit into variables.What you can capture
dir:Working directory, this step only.Working directory
soft:A non-zero exit continues the timeline instead of halting it.Errors
quiet:Hide output on success.Hiding noisy output

A string runs through the shell; a list runs directly, one element per argument. See Running commands.

get: keys ​

KeyMeaning
info:Prompt text.
default:Pre-filled value, used as-is when prompts are off.
options:Turns it into a select. A list literal or a variable holding one.
multi:Multi-select; the result is an array.
check:Shell condition the answer must satisfy (exit 0).
secret:Mask wherever hobnob shows it; command output is not.
optional:Skip silently if unanswered, leaving the variable empty.

See Prompts.

call: keys ​

KeyMeaning
call:The task to run, module:task for an imported one.
with:Variables set in the child's copy of scope.
into:Variables pulled back from the child; replaces its results:.
dir:Working directory for the child; beats the child's own dir:.
soft:A failed call continues the timeline instead of halting it.

See Calling tasks.

loop: forms ​

FormIteratesVariables
loop: .LISTAn array, in order.ITEM
loop: .OBJECTAn object, in sorted-key order.KEY, VALUE
loop: { A: […], B: […] }Every combination of the arrays.A, B

See Loops.

Modules ​

KeyMeaning
path:File to import, relative to the importing taskfile.
show:Whitelist. Only these task names are imported.
hide:Blacklist. Everything else is imported.
flatten:Also register tasks under their bare name.

The short form - key: ./file.yml sets only path:. See Modules.

Built-in variables ​

NameHolds
HOBNOB_FILE_DIRDirectory containing the hobnob file.
HOBNOB_INVOCATION_DIRDirectory hobnob was run from.

Released under the BSD-3-Clause License.