import { type Options, type ResultPromise, type ExecaScriptMethod, VerboseObject } from 'execa'; import { sleep } from './utils'; import { WatchDirOptions } from './fs'; import { ChildProcess } from 'child_process'; declare const verbose: (verboseLine: string, verboseObject: VerboseObject) => void; export declare const $: ExecaScriptMethod; export declare function exec(cmd: string, options?: Options): ResultPromise; export declare class ShellContext { private _cwdStack; private _env; logCommand: boolean; execaOptions: Options | undefined; sleep: typeof sleep; /** * get current word directory */ get cwd(): string; protected _logger: import("./logger").Logger; private readonly _process; /** * change work directory * @param dir */ cd(dir: string): this; /** * like pushd in shell * @param dir */ pushd(dir: string): this; /** * like popd in shell */ popd(): this; get $(): ExecaScriptMethod; /** * NOTE!!!: New multiple commands are written as a single string with multiple lines, * execute command, * * @param command * @param options * @example * ```ts * await ctx.exec('echo 1') * * await ctx.exec(` * echo 1 * sleep 1 * echo 2 * `) * ``` */ exec(command: string, options?: Options): ResultPromise; /** * set/get/delete env * set: ctx.env('key', 'val') * set: ctx.env('key=val') * delete: ctx.env('key', void 0) * @param key */ env(key: string): this; env(key: string, val: string | undefined): this; /** * restart processes when file changes * @example * ctx.monitor('./src', 'tsc') * ctx.monitor('./src', 'webpack') * ctx.monitor('./src', 'foy watch') * ctx.monitor('./src', ['rm -rf dist', 'foy watch']) * ctx.monitor('./src', async p => { * await fs.rmrf('dist') * p.current = ctx.exec('webpack serve') * }) */ monitor(dir: string, run: ((p: { current: ChildProcess | null; }) => void) | string | string[], options?: WatchDirOptions & { ignore?: (event: string, file: string | null) => boolean; }): void; /** * reset env to default */ resetEnv(): this; } export declare function shell(callback: (ctx: ShellContext) => Promise): Promise; export {};