@jsnix/pastel
Version:
Framework for effortlessly building Ink apps
49 lines (48 loc) • 1.66 kB
TypeScript
import type { Instance, RenderOptions } from 'ink';
import readCommands from './read-commands.js';
import type { CommandArgumentConfig, CommandOptionConfig, PastelInterface } from './types.js';
export type Options = {
/**
* Program name. Defaults to `name` in the nearest package.json or the name of the executable.
*/
name?: string;
/**
* Version. Defaults to `version` in the nearest package.json.
*/
version?: string;
/**
* Description. Defaults to `description` in the nearest package.json.
*/
description?: string;
/**
* Pass in [`import.meta`](https://nodejs.org/dist/latest/docs/api/esm.html#esm_import_meta). This is used to find the `commands` directory.
*/
importMeta: ImportMeta;
/**
* Pass in Ink options
*/
renderOptions?: RenderOptions;
};
export default class Pastel implements PastelInterface {
#private;
private readonly options;
constructor(options: Options);
get renderOptions(): RenderOptions | undefined;
set render(render: Instance);
get render(): Instance | undefined;
/**
* Run the app.
*/
run(argv?: string[]): Promise<Instance>;
}
/**
* Set additional metadata for an option. Must be used as an argument to `describe` function from Zod.
*/
export declare function option(config: CommandOptionConfig): string;
/**
* Set additional metadata for an argument. Must be used as an argument to `describe` function from Zod.
*/
export declare function argument(config: CommandArgumentConfig): string;
export * from './types.js';
export { readCommands };
export type { Command } from './internal-types.js';