/*! * Copyright (c) Microsoft Corporation and contributors. All rights reserved. * Licensed under the MIT License. */ import { Command, type Interfaces } from "@oclif/core"; import type { PrettyPrintableError } from "@oclif/core/errors"; import { type IBuildProject } from "@fluid-tools/build-infrastructure"; import type { CommandLogger } from "../../logging.js"; import { Context } from "../context.js"; /** * A type representing all the flags of the base commands and subclasses. */ export type Flags = Interfaces.InferredFlags<(typeof BaseCommand)["baseFlags"] & T["flags"]>; export type Args = Interfaces.InferredArgs; /** * A base command that sets up common flags that all commands should have. Most commands should have this class in their * inheritance chain. * * @remarks * * This implementation is based on the documentation at https://oclif.io/docs/base_class */ export declare abstract class BaseCommand extends Command implements CommandLogger { /** * The flags defined on the base class. */ static readonly baseFlags: { readonly verbose: Interfaces.BooleanFlag; readonly quiet: Interfaces.BooleanFlag; readonly root: Interfaces.OptionFlag; readonly flubConfig: Interfaces.OptionFlag; readonly timer: Interfaces.BooleanFlag; }; protected flags: Flags; protected args: Args; /** * If true, all logs except those sent using the .log function will be suppressed. */ private suppressLogging; private _context; private _logger; init(): Promise; protected catch(err: Error & { exitCode?: number; }): Promise; protected finally(_: Error | undefined): Promise; /** * A default logger that can be passed to core functions enabling them to log using the command logging * system */ protected get logger(): CommandLogger; /** * The repo {@link Context}. The context is retrieved and cached the first time this method is called. Subsequent * calls will return the cached context. * * @returns The repo {@link Context}. */ getContext(): Promise; /** * Outputs a horizontal rule. */ logHr(): void; /** * Logs a message with an indent. */ logIndent(input: string, indentNumber?: number): void; /** * Logs an informational message. */ info(message: string | Error | undefined): void; /** * Logs an error without exiting. */ errorLog(message: string | Error | undefined): void; /** * Logs a warning. */ warning(message: string | Error): string | Error; /** * Logs a warning with a stack trace in debug mode. */ warningWithDebugTrace(message: string | Error): string | Error; /** * @deprecated Use {@link BaseCommand.warning} or {@link BaseCommand.warningWithDebugTrace} instead. */ warn(input: string | Error): string | Error; /** * Logs an error and exits the process. If you don't want to exit the process use {@link BaseCommand.errorLog} * instead. * * @param input - an Error or a error message string, * @param options - options for the error handler. * * @remarks * * This method overrides the oclif Command error method so we can do some formatting on the strings. */ error(input: string | Error, options: { code?: string | undefined; exit: false; } & PrettyPrintableError): void; /** * Logs an error and exits the process. If you don't want to exit the process use {@link BaseCommand.errorLog} * instead. * * @param input - an Error or a error message string, * @param options - options for the error handler. * * @remarks * * This method overrides the oclif Command error method so we can do some formatting on the strings. */ error(input: string | Error, options?: ({ code?: string | undefined; exit?: number | undefined; } & PrettyPrintableError) | undefined): never; /** * Logs a verbose log statement. */ verbose(message: string | Error): string | Error; } export declare abstract class BaseCommandWithBuildProject extends BaseCommand { private _buildProject; /** * This method is deprecated and should only be called in BaseCommand instances. * * @deprecated This method should only be called in BaseCommand instances. */ getContext(): never; /** * Gets the build project for the current command. The build project is loaded from the closest build root to searchPath. * * @param searchPath - The path to search for the build project. * @returns The build project. */ getBuildProject(searchPath?: string): IBuildProject; } //# sourceMappingURL=base.d.ts.map