import { Command, Usage } from "clipanion"; import { ExecSyncOptionsWithBufferEncoding } from "node:child_process"; import { quote } from "shlex"; export declare class TxtCommand extends Command { static paths?: string[][]; static usage: Usage; txtFiles: string[]; command: string; yes: boolean; wait: boolean; waitTimeout?: string | undefined; session: string; execute(): Promise; } export declare enum SessionControl { Start = "start", ReStart = "restart", Continue = "continue" } export type CommandBuilderContext = { /** current line */ line: string; /** args split from line */ args: string[]; /** helper: apply command template */ applyCommandTemplate: typeof applyCommandTemplate; /** helper: shlex.quote */ quote: typeof quote; }; export declare function applyCommandTemplate(command: string, { line, args }: Pick): string; export interface RunContext extends CommandBuilderContext { /** shortcut for `execSync` */ runCommandSync: (command: string) => void; /** the txt file being processed */ txtFile: string; } export interface StartTxtCommandOptions extends Pick { txtFiles: string | string[]; session: SessionControl; execOptions?: Partial; command?: string | ((ctx: CommandBuilderContext) => string); run?: (ctx: RunContext) => void | Promise; isRunningPostActions?: () => boolean; waitPostActions?: () => Promise | void; } export declare const defaultTxtCommandContext: { session: SessionControl.Continue; }; export declare function startTxtCommand(opts: StartTxtCommandOptions): Promise; export declare class TxtFileSessionController { txtFile: string; sessionFile: string; constructor(txtFile: string); load: () => Set; save: (processedLines: Set) => void; run: (action: SessionControl) => void; private start; private restart; private continue; } export declare function drainSingleTxtFile(txtFile: string, { yes, command, run, execOptions }: Pick): Promise; export declare abstract class BaseCommand extends Command { /** * glob */ files: string; ignoreCase: boolean; globCwd: string | undefined; yes: boolean; showTokens: boolean; abstract execute(): Promise; } export interface FilenameTokens { fullpath: string; dir: string; file: string; name: string; ext: string; pdir: string; rname: string; } export declare function getFilenameTokens(item: string): FilenameTokens; export declare function renderFilenameTokens(template: string, options: FilenameTokens): string; export declare function printFilenameTokens(tokens: FilenameTokens): void;