howdy/jobs/cli

Command-line management of an app’s jobs, for servers without the admin. Give it a way to open the app’s database, in a task module:

// src/tasks/jobs.gleam
import howdy/jobs/cli

pub fn main() -> Nil {
  cli.main(fn() { my_app.database() })
}
gleam run -m tasks/jobs stats
gleam run -m tasks/jobs retry --failed --job welcome_email

In a release built with gleam export erlang-shipment, run it from the release directory, with the arguments after -extra:

erl -pa */ebin -noshell -eval 'tasks@jobs:main()' -extra stats

Changes go straight to the database, and running nodes see them the next time they look for jobs.

Types

What a command printed, and its exit status: 0 for success, 1 when the command failed, 2 when it was not understood.

pub type Outcome {
  Outcome(status: Int, output: String)
}

Constructors

  • Outcome(status: Int, output: String)

Values

pub fn main(
  open: fn() -> Result(repo.Repo, service.Error),
) -> Nil

Run the command the process was started with, print what it says, and exit with its status.

pub fn run(
  open: fn() -> Result(repo.Repo, service.Error),
  arguments: List(String),
) -> Outcome

Run one command without printing or exiting.

✨ Search Document