import { FS } from '../file/emscriptenFs'; import { File } from '../file/file'; import { NativeResult } from '../imageMagick/createMain'; import { IFile, Options } from '../types'; import { main } from './main'; import { run } from './run'; export declare function isCustomCommand(c: string[]): Promise; /** * In [run]'s [script] property, or in commands given to [main], lines starting with `!js:` are be evaluated as a JavaScript function that accept one parameter context which is an object containing utilities that can be used asynchronously. This interface describes such an object. The expression `!js:` can be configured using [Options]. * * ```js * result = await run({ * script: ` * convert rose: foo.gif * !js: c=>c.pushStdout(FS.readdir('.').join(', ')) * !js: async c=> {const f = c.File.asFile(c.files[0]) ; c.pushStdout(JSON.stringify(await f.size())) } * ` * }) * ``` */ export interface CustomCommandContext { FS: FS; options: Partial; log(...s: string[]): void; error(...s: string[]): void; File: typeof File; writeFile(f: File): void; isFile(f: string): boolean; readFile(f: string): File; isDirectory(f: string): boolean; run: typeof run; main: typeof main; includeOutputFiles(files: (string | IFile)[], exclude?: boolean): void; } export interface CustomCommandDispatchOptions { command: string[]; options: Partial; FS: FS; /** can be used by custom commands to manipulate outputFiles*/ outputFiles: File[]; } export declare function dispatchCustomCommand(o: CustomCommandDispatchOptions): Promise;