import { Options } from "execa";

//#region lib/util/exec/types.d.ts
interface ToolConstraint {
  toolName: string;
  constraint?: string | null;
}
interface ToolConfig {
  datasource: string;
  extractVersion?: string;
  packageName: string;
  versioning: string;
}
type Opt<T> = T | null | undefined;
type VolumesPair = [string, string];
type VolumeOption = Opt<string | VolumesPair>;
interface DockerOptions {
  volumes?: Opt<VolumeOption[]>;
  envVars?: Opt<Opt<string>[]>;
  cwd?: Opt<string>;
}
type DataListener = (chunk: any) => void;
interface OutputListeners {
  stdout?: DataListener[];
  stderr?: DataListener[];
}
interface RawExecOptions extends Options {
  maxBuffer?: number | undefined;
  cwd?: string;
  outputListeners?: OutputListeners;
}
interface ExecResult {
  stdout: string;
  stderr: string;
  /**
   * The process' exit code in the case of a failure.
   *
   * This is only set if using `ignoreFailure` when executing a command
   *
   */
  exitCode?: number;
}
type ExtraEnv<T = unknown> = Record<string, T>;
interface ExecOptions {
  cwd?: string;
  cwdFile?: string;
  env?: Opt<ExtraEnv>;
  extraEnv?: Opt<ExtraEnv>;
  docker?: Opt<DockerOptions>;
  toolConstraints?: Opt<ToolConstraint[]>;
  preCommands?: Opt<string[]>;
  ignoreStdout?: boolean;
  maxBuffer?: number | undefined;
  timeout?: number | undefined;
  shell?: boolean | string | undefined;
}
/**
 * configuration that can be configured on a per-command basis, that doesn't make sense to be on the `RawExecOptions`
 */
interface CommandWithOptions {
  command: string[];
  /** do not throw errors when a command fails, but do log that an error occurred */
  ignoreFailure?: boolean;
  /**
   * Execute the `command` within a shell
   *
   * WARNING this can result in security issues if this includes user-controlled commands
   * **/
  shell?: boolean | string;
}
//#endregion
export { CommandWithOptions, DataListener, DockerOptions, ExecOptions, ExecResult, ExtraEnv, Opt, OutputListeners, RawExecOptions, ToolConfig, ToolConstraint, VolumeOption, VolumesPair };
//# sourceMappingURL=types.d.ts.map