Module

commands/register

Methods

# static registerCMD()

Takes a Command object with some additional information and returns a Command runable in a Task or as-is.

Example

const genie = {
  sub$: "GENIE",
  args: "your wish"
  work: x => console.log("🧞 says:", x, "is my command")
}

const GENIE = registerCMD(genie)

run(GENIE)
// 🧞 says: your wish is my command

A Command object can have four keys:

  1. sub$ (required)
  2. args (optional, sets default) during registration
  3. work (required)
  4. src$ (optional, enables stream to feed Command)

View Source registers/registerCMD.ts, line 49