Frequently asked/answered questions

Defining/executing tasks

My task’s first/only argument isn’t showing up in --help!

Make sure your task isn’t contextualized unexpectedly! Put another way, this problem pops up if you’re using @ctask and forget to define an initial context argument for your task.

For example, can you spot the problem in this sample task file?

from invoke import ctask as task

def build(ctx, where, clean=False):

def clean(what):

This task file doesn’t cause obvious errors when sanity-checking it with inv --list or inv --help. However, clean forgot to set aside its first argument for the context - so Invoke is treating what as the context argument! This means it doesn’t show up in help output or other command-line parsing stages.

The command line says my task’s first/only argument is invalid!

See My task’s first/only argument isn’t showing up in –help! - it’s probably the same issue.