Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/cliffy/command/mod.ts>Type

Command line framework for deno 🦕 Including Commandline-Interfaces, Prompts, CLI-Table, Arguments Parser and more...
Extremely Popular
Go to Latest
class Type
Re-export
Abstract
import { Type } from "https://deno.land/x/cliffy@v0.18.2/command/mod.ts";

Base class for custom types.

Custom type example:

export class ColorType extends Type<string> {
  public parse({ label, name, value, type }: ITypeInfo): string {
    if (["red", "blue"].includes(value)) {
      trow new Error(
        `${label} "${name}" must be of type "${type}", but got "${value}".` +
        "Valid colors are: red, blue"
      );
    }
    return value;
  }

  public complete(): string[] {
    return ["red", "blue"];
  }
}

Methods

optional
complete(cmd: Command<any, any, any, any, any>, parent?: Command<any, any, any, any, any>): string[]
abstract
parse(type: ITypeInfo): T