@nu-art/commando
Version:
59 lines (58 loc) • 2.07 kB
TypeScript
import { BaseCommando } from '../core/BaseCommando';
import { CliBlock } from '../types';
type Cli_EchoOptions = {
escape?: boolean;
toFile?: {
name: string;
append?: boolean;
};
};
type Cli_RmdirOptions = {
force?: true;
recursive?: true;
};
type Cli_CpdirOptions = {
contentOnly?: boolean;
};
/**
* Represents a Command Line Interface (CLI) to build and execute shell commands.
*/
export declare class Commando_Basic extends BaseCommando {
/**
* Changes directory and optionally executes a block of commands in that directory.
* @param {string} folderName - Name of the directory to change to.
* @param {CliBlock} [toRun] - Optional block of commands to execute in the directory.
* @returns {this} - The Cli instance for method chaining.
*/
cd(folderName: string, toRun?: CliBlock<this>): this;
custom(command: string): this;
/**
* Changes directory back to the previous directory.
* @returns {this} - The Cli instance for method chaining.
*/
cd_(): this;
/**
* Appends an 'ls' command with optional parameters.
* @param {string} [params] - Optional parameters for the 'ls' command.
* @returns {this} - The Cli instance for method chaining.
*/
ls(params?: string): this;
mkdir(dirName: string): this;
rmdir(dirPath: string, options?: Cli_RmdirOptions): this;
cpdir(srcPath: string, destPath: string, options?: Cli_CpdirOptions): this;
cat(fileName: string): this;
echo(log: string, options?: Cli_EchoOptions): this;
/**
* Appends a 'pwd' command to print the current directory.
* @returns {this} - The Cli instance for method chaining.
*/
pwd(): this;
/**
* Assigns a value to a variable in the script.
* @param {string} varName - The name of the variable.
* @param {string | string[]} value - The value to assign to the variable.
* @returns {this} - The Cli instance for method chaining.
*/
assignVar(varName: string, value: string | string[]): this;
}
export {};