What are Tasks?

Tasks are small scripts that are often needed when writing an application. These tasks might be along the lines of seeding a database, parsing a log file, or even a release script. Buffalo uses the grift package to make writing these tasks simple.

Writing Tasks

Tasks must all be in the grifts package. A simple task would look like following:

var _ = grift.Add("hello", func(c *grift.Context) error {
  return nil

Listing Available Tasks

$ buffalo task list
// output
buffalo task db:seed
buffalo task db:seed:pets
buffalo task db:seed:users
buffalo task hello
buffalo task routes

Running Tasks


Tasks can be run in development using the buffalo task command.

$ buffalo task hello

From a Built Binary

After a binary has been built the tasks can be run with the task subcommand:

$ myapp task hello