@nu-art/commando
Version:
53 lines (52 loc) • 1.74 kB
TypeScript
/**
* Type definition for options used in the CommandBuilder class.
*/
type Options = {
newlineDelimiter: string;
indentation: number;
};
export declare class CommandBuilder {
commands: string[];
private indentation;
private option;
/**
* Constructs a CommandBuilder instance with given options.
* @param {Partial<Options>} [options=defaultOptions] - Configuration options for the CommandBuilder instance.
*/
constructor(options?: Partial<Options>);
/**
* Generates a string of spaces for indentation based on the current indentation level.
* @returns {string} - A string containing spaces for the current indentation level.
*/
protected getIndentation: () => string;
/**
* Increases the current indentation level by one.
*/
readonly indentIn: () => void;
/**
* Decreases the current indentation level by one.
*/
readonly indentOut: () => void;
/**
* Appends an empty line to the command list for readability.
* @returns {this} - The CommandBuilder instance for method chaining.
*/
emptyLine(): this;
/**
* Appends a command to the command list with proper indentation.
* @param {string} command - The command to append.
* @returns {this} - The CommandBuilder instance for method chaining.
*/
readonly append: (command: string) => this;
/**
* Retrieves the full command list as a single string.
* @returns {string} - The full command list.
*/
getCommand(): string;
/**
* Resets the command list and returns the previously accumulated commands.
* @returns {string} - The previously accumulated commands.
*/
reset(): string;
}
export {};