///
import execa from 'execa';
import { WatchDirOptions } from './fs';
import { ChildProcess } from 'child_process';
export { execa };
export declare function exec(command: string, options?: execa.Options): execa.ExecaChildProcess;
export declare function exec(commands: string[], options?: execa.Options): Promise[]>;
export declare const spawn: {
(file: string, arguments?: readonly string[] | undefined, options?: execa.Options | undefined): execa.ExecaChildProcess;
(file: string, arguments?: readonly string[] | undefined, options?: execa.Options | undefined): execa.ExecaChildProcess;
(file: string, options?: execa.Options | undefined): execa.ExecaChildProcess;
(file: string, options?: execa.Options | undefined): execa.ExecaChildProcess;
sync(file: string, arguments?: readonly string[] | undefined, options?: execa.SyncOptions | undefined): execa.ExecaSyncReturnValue;
sync(file: string, arguments?: readonly string[] | undefined, options?: execa.SyncOptions | undefined): execa.ExecaSyncReturnValue;
sync(file: string, options?: execa.SyncOptions | undefined): execa.ExecaSyncReturnValue;
sync(file: string, options?: execa.SyncOptions | undefined): execa.ExecaSyncReturnValue;
command(command: string, options?: execa.Options | undefined): execa.ExecaChildProcess;
command(command: string, options?: execa.Options | undefined): execa.ExecaChildProcess;
commandSync(command: string, options?: execa.SyncOptions | undefined): execa.ExecaSyncReturnValue;
commandSync(command: string, options?: execa.SyncOptions | undefined): execa.ExecaSyncReturnValue;
node(scriptPath: string, arguments?: readonly string[] | undefined, options?: execa.NodeOptions | undefined): execa.ExecaChildProcess;
node(scriptPath: string, arguments?: readonly string[] | undefined, options?: execa.Options | undefined): execa.ExecaChildProcess;
node(scriptPath: string, options?: execa.Options | undefined): execa.ExecaChildProcess;
node(scriptPath: string, options?: execa.Options | undefined): execa.ExecaChildProcess;
};
export declare class ShellContext {
private _cwdStack;
private _env;
logCommand: boolean;
sleep: (ms: number) => Promise;
/**
* 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;
/**
* execute command(s)
* @param command
* @param options
*/
exec(command: string, options?: execa.Options): execa.ExecaChildProcess;
exec(commands: string[], options?: execa.Options): Promise;
/**
* spawn file
* @param file
* @param args
* @param options
*/
spawn(file: string, args?: string[], options?: execa.Options): execa.ExecaChildProcess;
/**
* set/get/delete env
* set: ctx.env('key', 'val')
* get: ctx.env('key')
* delete: ctx.env('key', void 0)
* @param key
*/
env(key: string): string | undefined;
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) => boolean;
}): void;
/**
* reset env to default
*/
resetEnv(): this;
private _logCmd;
}
export declare function shell(callback: (ctx: ShellContext) => Promise): Promise;