UNPKG

@decaf-ts/fabric-weaver

Version:
44 lines (43 loc) 1.23 kB
import { Command } from "commander"; import { Logger } from "@decaf-ts/logging"; /** * @class BaseCLI * @description Base class for creating command-line interfaces using Commander * @summary This class provides a foundation for building CLIs in the Fabric Weaver project. * It sets up a Commander program with basic configuration and logging. * * @example * class MyCLI extends BaseCLI { * constructor() { * super("my-cli", "My CLI description"); * this.setupCommands(); * } * * private setupCommands() { * this.program * .command("hello") * .description("Say hello") * .action(() => console.log("Hello, world!")); * } * } * * const cli = new MyCLI(); * cli.run(); */ export declare abstract class BaseCLI { protected program: Command; protected log: Logger; /** * @constructor * @param {string} name - The name of the CLI program * @param {string} description - A brief description of the CLI program */ constructor(name: string, description: string); private sleep; private copy; /** * @method run * @description Parses the command-line arguments and executes the appropriate command */ run(): void; }