// Loaded from https://deno.land/x/cliffy@v0.12.1/packages/command/lib/types.ts import { IFlagArgument, IFlagOptions, ITypeHandler } from '../../flags/lib/types.ts'; import { Type } from '../types/type.ts'; import { Command } from './command.ts'; /** Description handler. */ export type IDescription = string | ( ( this: Command ) => string ); /** Action handler. */ export type IAction> = ( this: Command, options: O, ...args: A ) => void | Promise; /** Argument details. */ export interface IArgumentDetails extends IFlagArgument { /** Argument name. */ name: string; /** Shell completion action. */ action: string; /** Arguments type. */ type: string; } /** Command settings. */ export interface ICommandOption = any> extends Omit { override?: boolean; hidden?: boolean; global?: boolean; action?: IAction; prepend?: boolean; } /** Command option setting's. */ export interface IOption = any> extends ICommandOption, IFlagOptions { description: string, flags: string; typeDefinition?: string; args: IArgumentDetails[]; } export interface IEnvVarOption { hidden?: boolean; global?: boolean; } /** Environment variable setting's. */ export interface IEnvVariable extends IEnvVarOption { names: string[]; description: string; type: string; details: IArgumentDetails; } /** Type option's. */ export interface ITypeOption { override?: boolean; global?: boolean; } /** Type option's. */ export interface ITypeSettings extends ITypeOption { name: string; handler: Type | ITypeHandler; } export type ITypeMap = Map; /** Example setting's. */ export interface IExample { name: string; description: string; } /** Result of `cmd.parse()`. */ export interface IParseResult = any> { options: O; args: A; literal: string[]; cmd: Command; } export interface ICompleteOptions { override?: boolean; global?: boolean; } export interface ICompleteSettings extends ICompleteOptions { name: string; complete: ICompleteHandler; } /** Type parser method. */ export type ICompleteHandler = ( cmd: Command, parent?: Command ) => string[] | Promise;