Skip to main content
Module

x/enzastdlib/commands/mod.ts>CommandCallback

enzastdlib is a set of TypeScript modules that follow a common design API philosophy aiming at sane defaults and ease-of-use targeting the Deno TypeScript runtime.
Latest
type alias CommandCallback
Re-export
import { type CommandCallback } from "https://deno.land/x/enzastdlib@v0.0.4/commands/mod.ts";

Represents the typing of a command callback that can be registered.

Examples

Example 1

import type { CommandCallback } from 'https://deno.land/x/enzastdlib/commands/mod.ts';

// **WARNING**: You need to use named functions instead of arrow syntax for
// registering commands. This example is for demonstration purposes only.

const mycommand = ((options) => {
    // `options.msg` is equivalent `deno run ./mod.ts mycommand --msg ...`.
    console.log(`Hello ${options.msg}!`);
}) satisfies CommandCallback;

Type Parameters

optional
OptionsType extends any = any
definition: (options: OptionsType) => void | number | Promise<void | number>