UNPKG

@buddy-js/cli

Version:

A IaC tool to create your [Buddy CI] pipelines programmatically via JS/TS.

18 lines (17 loc) 973 B
import { Command, type Interfaces } from '@oclif/core'; import { type Instance } from 'ink'; import type { FunctionComponent } from 'react'; export type Flags<T extends typeof Command> = Interfaces.InferredFlags<(typeof BaseCommand)['baseFlags'] & T['flags']>; export type Args<T extends typeof Command> = Interfaces.InferredArgs<T['args']>; export type View<T> = FunctionComponent<T>; export declare abstract class BaseCommand<T extends typeof Command, V extends {}> extends Command { protected flags: Flags<T>; protected args: Args<T>; protected abstract view: View<V>; protected abstract initialState: V; protected viewInstance?: Instance; init(): Promise<void>; protected catch(err: Interfaces.CommandError): Promise<void>; run(): Promise<void | unknown>; abstract handle(): AsyncIterator<V | Partial<V> | ((state: V) => V | Partial<V>), unknown, never> | Iterator<V | Partial<V> | ((state: V) => V | Partial<V>), unknown, never>; }