import "./_dnt.polyfills.js";
import { CommandBuilder, type Delay, type ErrorTailOptions, type RawArg, type TailDisplayOptions, type TemplateExpr } from "./deps/jsr.io/@david/shell/0.5.2/mod.js";
import { symbols } from "./deps/jsr.io/@david/shell/0.5.2/internal.js";
import { type DelayIterator } from "./src/common.js";
import { type AlertOptions, type ConfirmOptions, type MultiSelectOptions, ProgressBar, type ProgressOptions, type PromptOptions, type SelectionItem, type SelectOptions } from "./src/console/mod.js";
import { Path } from "./deps/jsr.io/@david/path/0.3.2/mod.js";
import { RequestBuilder } from "./src/request.js";
import { outdent } from "./src/vendor/outdent.js";
export { type DirEntry, FsFileWrapper, Path, type SymlinkOptions } from "./deps/jsr.io/@david/path/0.3.2/mod.js";
export { type BeforeCommandCallback, type BeforeCommandSyncCallback, type CdChange, type Closer, CommandBuilder, CommandChild, type CommandContext, type CommandHandler, type CommandPipeReader, type CommandPipeWriter, CommandResult, type ContinueExecuteResult, createExecutableCommand, type Delay, type EnvChange, type ErrorTailOptions, type ExecuteResult, type ExitExecuteResult, KillController, KillSignal, type KillSignalListener, RawArg, type Reader, type SetEnvVarChange, type SetOptionChange, type SetShellVarChange, type ShellOption, type ShellOptionsState, type ShellPipeReaderKind, type ShellPipeWriterKind, type TailDisplayOptions, type TemplateExpr, type UnsetVarChange, type WriterSync, } from "./deps/jsr.io/@david/shell/0.5.2/mod.js";
export { type DelayIterator, TimeoutError } from "./src/common.js";
export { SelectionItem } from "./src/console/mod.js";
/** @deprecated Import `Path` instead. */
declare const PathRef: typeof Path;
export { PathRef };
export type { AlertOptions, ConfirmOptions, MultiSelectOption, MultiSelectOptions, ProgressBar, ProgressOptions, PromptInputMask, PromptOptions, SelectOptions, } from "./src/console/mod.js";
export { type BeforeRequestCallback, RequestBuilder, RequestResponse } from "./src/request.js";
/**
 * Cross platform shell tools for Deno inspired by [zx](https://github.com/google/zx).
 *
 * ```ts
 * import $ from "dax";
 *
 * await $`echo hello`;
 * ```
 *
 * @module
 */
/** Options for using `$.retry({ ... })` */
export interface RetryOptions<TReturn> {
    /** Number of times to retry. */
    count: number;
    /** Delay in milliseconds. */
    delay: Delay | DelayIterator;
    /** Action to retry if it throws. */
    action: () => Promise<TReturn>;
    /** Do not log. */
    quiet?: boolean;
}
/** Type of `$` instances. */
export type $Type<TExtras extends ExtrasObject = {}> = $Template & (string extends keyof TExtras ? $BuiltInProperties<TExtras> : Omit<$BuiltInProperties<TExtras>, keyof TExtras>) & TExtras;
/** String literal template. */
export interface $Template {
    (strings: TemplateStringsArray, ...exprs: TemplateExpr[]): CommandBuilder;
}
/**
 * `outdent` from the https://deno.land/x/outdent module.
 * @internal
 */
type Outdent = typeof outdent;
/**
 * `which` from the https://deno.land/x/which module.
 * @internal
 */
type Which = typeof import("./deps/jsr.io/@david/which/0.7.0/mod.js").which;
/**
 * `whichSync` from the https://deno.land/x/which module.
 * @internal
 */
type WhichSync = typeof import("./deps/jsr.io/@david/which/0.7.0/mod.js").whichSync;
/** Collection of built-in properties that come with a `$`. */
export interface $BuiltInProperties<TExtras extends ExtrasObject = {}> {
    /**
     * Makes a request to the provided URL throwing by default if the
     * response is not successful.
     *
     * ```ts
     * const data = await $.request("https://plugins.dprint.dev/info.json")
     *  .json();
     * ```
     *
     * @see {@link RequestBuilder}
     */
    request(url: string | URL): RequestBuilder;
    /**
     * Builds a new `$` which will use the state of the provided
     * builders as the default and inherits settings from the `$` the
     * new `$` was built from.
     *
     * This can be useful if you want different default settings or want
     * to change loggers for only a subset of code.
     *
     * Example:
     *
     * ```ts
     * import $ from "dax";
     *
     * const commandBuilder = new CommandBuilder()
     *   .cwd("./subDir")
     *   .env("HTTPS_PROXY", "some_value");
     * const requestBuilder = new RequestBuilder()
     *   .header("SOME_VALUE", "value");
     *
     * const new$ = $.build$({
     *   commandBuilder,
     *   requestBuilder,
     *   // optional additional functions to add to `$`
     *   extras: {
     *     add(a: number, b: number) {
     *       return a + b;
     *     },
     *   },
     * });
     *
     * // this command will use the env described above, but the main
     * // process and default `$` won't have its environment changed
     * await new$`deno run my_script.ts`;
     *
     * // similarly, this will have the headers that were set in the request builder
     * const data = await new$.request("https://plugins.dprint.dev/info.json").json();
     *
     * // use the extra function we defined
     * console.log(new$.add(1, 2));
     * ```
     */
    build$<TNewExtras extends ExtrasObject = {}>(options?: Create$Options<TNewExtras>): $Type<Omit<TExtras, keyof TNewExtras> & TNewExtras>;
    /**
     * Escapes an argument for the shell when NOT using the template
     * literal.
     *
     * This is done by default in the template literal, so you most likely
     * don't need this, but it may be useful when using the command builder.
     *
     * For example:
     *
     * ```ts
     * const builder = new CommandBuilder()
     *  .command(`echo ${$.escapeArg("some text with spaces")}`);
     *
     * // equivalent to this:
     * const builder = new CommandBuilder()
     *  .command(`echo 'some text with spaces'`);
     *
     * // you may just want to do this though:
     * const builder = new CommandBuilder()
     *  .command(["echo", "some text with spaces"]);
     * ```
     */
    escapeArg(arg: string): string;
    /** Strips ANSI escape codes from a string */
    stripAnsi(text: string): string;
    /**
     * De-indents (a.k.a. dedent/outdent) template literal strings
     *
     * Re-export of https://deno.land/x/outdent
     *
     * Removes the leading whitespace from each line,
     * allowing you to break the string into multiple
     * lines with indentation. If lines have an uneven
     * amount of indentation, then only the common
     * whitespace is removed.
     *
     * The opening and closing lines (which contain
     * the ` marks) must be on their own line. The
     * opening line must be empty, and the closing
     * line may contain whitespace. The opening and
     * closing line will be removed from the output,
     * so that only the content in between remains.
     */
    dedent: Outdent;
    /**
     * Determines if the provided command exists resolving to `true` if the command
     * will be resolved by the shell of the current `$` or false otherwise.
     */
    commandExists(commandName: string): Promise<boolean>;
    /**
     * Determines if the provided command exists resolving to `true` if the command
     * will be resolved by the shell of the current `$` or false otherwise.
     */
    commandExistsSync(commandName: string): boolean;
    /** Helper function for creating path references, which provide an easier way for
     * working with paths, directories, and files on the file system.
     *
     * The function creates a new `Path` from a path or URL string, file URL, or for the current module.
     */
    path: typeof createPath;
    /**
     * Logs with potential indentation (`$.logIndent`)
     * and output of commands or request responses.
     *
     * Note: Everything is logged over stderr.
     */
    log(...data: any[]): void;
    /**
     * Similar to `$.log`, but logs out the text lighter than usual. This
     * might be useful for logging out something that's unimportant.
     */
    logLight(...data: any[]): void;
    /**
     * Similar to `$.log`, but will bold green the first word if one argument or
     * first argument if multiple arguments.
     */
    logStep(firstArg: string, ...data: any[]): void;
    /**
     * Similar to `$.logStep`, but will use bold red.
     */
    logError(firstArg: string, ...data: any[]): void;
    /**
     * Similar to `$.logStep`, but will use bold yellow.
     */
    logWarn(firstArg: string, ...data: any[]): void;
    /**
     * Causes all `$.log` and like functions to be logged with indentation.
     *
     * ```ts
     * $.logGroup(() => {
     *   $.log("This will be indented.");
     *   $.logGroup(() => {
     *     $.log("This will indented even more.");
     *   });
     * });
     *
     * const result = await $.logGroup(async () => {
     *   $.log("This will be indented.");
     *   const value = await someAsyncWork();
     *   return value * 5;
     * });
     * ```
     * @param action - Action to run and potentially get the result for.
     */
    logGroup<TResult>(action: () => TResult): TResult;
    /**
     * Causes all `$.log` and like functions to be logged with indentation and a label.
     *
     * ```ts
     * $.logGroup("Some label", () => {
     *   $.log("This will be indented.");
     * });
     * ```
     * @param label Title message to log for this level.
     * @param action Action to run and potentially get the result for.
     */
    logGroup<TResult>(label: string, action: () => TResult): TResult;
    /**
     * Causes all `$.log` and like functions to be logged with indentation.
     *
     * ```ts
     * $.logGroup();
     * $.log("This will be indented.");
     * $.logGroup("Level 2");
     * $.log("This will be indented even more.");
     * $.logGroupEnd();
     * $.logGroupEnd();
     * ```
     *
     * Note: You must call `$.logGroupEnd()` when using this.
     *
     * It is recommended to use `$.logGroup(() => { ... })` over this one
     * as it will internally call `$.logGroupEnd()` even when exceptions
     * are thrown.
     *
     * @param label Optional title message to log for this level.
     */
    logGroup(label?: string): void;
    /**
     * Ends a logging level.
     *
     * Meant to be used with `$.logGroup();` when not providing a function..
     */
    logGroupEnd(): void;
    /** Gets or sets the current log depth (0-indexed). */
    logDepth: number;
    /**
     * Shows an alert message that blocks until the user acknowledges it.
     *
     * By default, any key press dismisses the alert. Set `requireEnter` to
     * `true` to require pressing Enter instead.
     *
     * @returns Resolves once the alert is dismissed, or exits the process if the user pressed ctrl+c.
     */
    alert(message: string, options?: Omit<AlertOptions, "message">): Promise<void>;
    /**
     * Shows an alert message that blocks until the user acknowledges it.
     *
     * @returns Resolves once the alert is dismissed, or exits the process if the user pressed ctrl+c.
     */
    alert(options: AlertOptions): Promise<void>;
    /**
     * Shows a prompt asking the user to answer a yes or no question.
     *
     * @returns `true` or `false` if the user made a selection or `undefined` if the user pressed ctrl+c.
     */
    maybeConfirm(message: string, options?: Omit<ConfirmOptions, "message">): Promise<boolean | undefined>;
    /**
     * Shows a prompt asking the user to answer a yes or no question.
     *
     * @returns `true` or `false` if the user made a selection or `undefined` if the user pressed ctrl+c.
     */
    maybeConfirm(options: ConfirmOptions): Promise<boolean | undefined>;
    /**
     * Shows a prompt asking the user to answer a yes or no question.
     *
     * @returns `true` or `false` if the user made a selection or exits the process if the user pressed ctrl+c.
     */
    confirm(message: string, options?: Omit<ConfirmOptions, "message">): Promise<boolean>;
    /**
     * Shows a prompt asking the user to answer a yes or no question.
     *
     * @returns `true` or `false` if the user made a selection or exits the process if the user pressed ctrl+c.
     */
    confirm(options: ConfirmOptions): Promise<boolean>;
    /**
     * Shows a prompt selection to the user where there is one possible answer.
     *
     * @returns A {@link SelectionItem} with the selected index and value, or `undefined` if the user pressed ctrl+c.
     * The returned item coerces to its index, so it can be used directly as an array index.
     */
    maybeSelect(options: SelectOptions): Promise<SelectionItem | undefined>;
    /**
     * Shows a prompt selection to the user where there is one possible answer.
     *
     * @returns A {@link SelectionItem} with the selected index and value, or exits the process if the user pressed ctrl+c.
     * The returned item coerces to its index, so it can be used directly as an array index.
     */
    select(options: SelectOptions): Promise<SelectionItem>;
    /**
     * Shows a prompt selection to the user where there are multiple or zero possible answers.
     *
     * @returns Array of {@link SelectionItem}s for selected options, or `undefined` if the user pressed ctrl+c.
     * Each item coerces to its index, so it can be used directly as an array index.
     */
    maybeMultiSelect(options: MultiSelectOptions): Promise<SelectionItem[] | undefined>;
    /**
     * Shows a prompt selection to the user where there are multiple or zero possible answers.
     *
     * @returns Array of {@link SelectionItem}s for selected options, or exits the process if the user pressed ctrl+c.
     * Each item coerces to its index, so it can be used directly as an array index.
     */
    multiSelect(options: MultiSelectOptions): Promise<SelectionItem[]>;
    /**
     * Shows an input prompt where the user can enter any text.
     *
     * @param message Message to show.
     * @param options Optional additional options.
     * @returns The inputted text or `undefined` if the user pressed ctrl+c.
     */
    maybePrompt(message: string, options?: Omit<PromptOptions, "message">): Promise<string | undefined>;
    /**
     * Shows an input prompt where the user can enter any text.
     *
     * @param options Options for the prompt.
     * @returns The inputted text or `undefined` if the user pressed ctrl+c.
     */
    maybePrompt(options: PromptOptions): Promise<string | undefined>;
    /**
     * Shows an input prompt where the user can enter any text.
     *
     * @param message Message to show.
     * @param options Optional additional options.
     * @returns The inputted text or exits the process if the user pressed ctrl+c.
     */
    prompt(message: string, options?: Omit<PromptOptions, "message">): Promise<string>;
    /**
     * Shows an input prompt where the user can enter any text.
     *
     * @param options Options for the prompt.
     * @returns The inputted text or exits the process if the user pressed ctrl+c.
     */
    prompt(options: PromptOptions): Promise<string>;
    /** Shows a progress message when indeterminate or bar when determinate. */
    progress(message: string, options?: Omit<ProgressOptions, "message" | "prefix">): ProgressBar;
    /** Shows a progress message when indeterminate or bar when determinate. */
    progress(options: ProgressOptions): ProgressBar;
    /**
     * Sets the logger used for info logging.
     * @default console.error
     */
    setInfoLogger(logger: (...args: any[]) => void): void;
    /**
     * Sets the logger used for warn logging.
     * @default console.error
     */
    setWarnLogger(logger: (...args: any[]) => void): void;
    /**
     * Sets the logger used for error logging.
     * @default console.error
     */
    setErrorLogger(logger: (...args: any[]) => void): void;
    /**
     * Mutates the internal command builder to print the command text by
     * default before executing commands instead of needing to build a
     * custom `$`.
     *
     * For example:
     *
     * ```ts
     * $.setPrintCommand(true);
     * const text = "example";
     * await $`echo ${text}`;
     * ```
     *
     * Outputs:
     *
     * ```
     * > echo example
     * example
     * ```
     *
     * @param value - Whether this should be enabled or disabled.
     */
    setPrintCommand(value: boolean): void;
    /**
     * Mutates the internal command builder to enable Docker-style partial
     * scrolling by default for all commands instead of needing to build a
     * custom `$` or call `.tailDisplay()` per command.
     *
     * ```ts
     * $.setTailDisplay(true);
     * await $`deno task build`; // tail-displayed by default
     *
     * // or with options
     * $.setTailDisplay({ maxLines: 10 });
     * ```
     *
     * @param value - `true` to enable with defaults, `false` to disable, or
     * an options object to enable with custom configuration.
     */
    setTailDisplay(value: boolean | TailDisplayOptions): void;
    /**
     * Mutates the internal command builder to enable errorTail capture by
     * default for all commands instead of needing to build a custom `$` or
     * call `.errorTail()` per command.
     *
     * ```ts
     * $.setErrorTail(true);
     * await $`deno task build`.text(); // captured stdout surfaces in the error if it fails
     *
     * // or with options
     * $.setErrorTail({ maxBytes: 16 * 1024 });
     * ```
     *
     * @param value - `true` to enable with defaults, `false` to disable, or
     * an options object to enable with custom configuration.
     */
    setErrorTail(value: boolean | ErrorTailOptions): void;
    /**
     * Sleep for the provided delay.
     *
     * ```ts
     * await $.sleep(1000); // ms
     * await $.sleep("1.5s");
     * await $.sleep("100ms");
     * ```
     */
    sleep(delay: Delay): Promise<void>;
    /** Symbols that can be attached to objects for better integration with Dax. */
    symbols: typeof symbols;
    /**
     * Executes the command as raw text without escaping expressions.
     *
     * ```ts
     * const expr = "some   text   to   echo";
     * $.raw`echo {expr}`; // outputs: some text to echo
     * ```
     *
     * @remarks Most likely you will want to escape arguments or provide
     * an array of arguments to the main `$` tagged template. For example:
     *
     * ```ts
     * const exprs = ["arg1", "arg two", "arg three"];
     * await $`command ${exprs}`;
     * ```
     */
    raw(strings: TemplateStringsArray, ...exprs: TemplateExpr[]): CommandBuilder;
    /**
     * Prevents an argument being escaped.
     *
     * ```ts
     * import $ from "dax";
     *
     * const value = "1    2     3";
     * await $`echo ${value}`; // 1    2     3
     * await $`echo ${$.rawArg(value)}`; // 1 2 3
     * ```
     */
    rawArg<T>(arg: T): RawArg<T>;
    /**
     * Does the provided action until it succeeds (does not throw)
     * or the specified number of retries (`count`) is hit.
     */
    withRetries<TReturn>(opts: RetryOptions<TReturn>): Promise<TReturn>;
    /**
     * Like `Promise.all`, but turns on `.tailDisplay()` for any
     * {@link CommandBuilder} values passed in so they share a fixed-height
     * region at the bottom of the terminal while running concurrently.
     *
     * The visible region targets ~90% of the terminal height divided evenly
     * across the items, with a minimum of 3 lines per item — so when there
     * are many items, the region may extend past the screen height.
     *
     * Non-`CommandBuilder` values are awaited as-is, so this can be mixed
     * with regular promises.
     *
     * ```ts
     * await $.all([
     *   $`deno task build frontend`,
     *   $`deno task build backend`,
     *   $`deno task build worker`,
     * ]);
     * ```
     *
     * Equivalent to:
     *
     * ```ts
     * await Promise.all([
     *   $`deno task build frontend`.tailDisplay({ maxLines: ... }),
     *   $`deno task build backend`.tailDisplay({ maxLines: ... }),
     *   $`deno task build worker`.tailDisplay({ maxLines: ... }),
     * ]);
     * ```
     *
     * Already-configured `.tailDisplay()` settings on a builder are
     * overridden — pass an explicit `Promise` (e.g. `(async () => ...)()`)
     * to opt out for a single item.
     */
    all<T extends readonly unknown[] | []>(values: T): Promise<{
        -readonly [P in keyof T]: Awaited<T[P]>;
    }>;
    /**
     * Variant of `$.all` that applies a transform to each `CommandBuilder`
     * after the auto-sized `.tailDisplay()` is applied. Useful for getting
     * structured output (`.text()`, `.json()`, etc.) without losing the
     * auto-sized tail display:
     *
     * ```ts
     * const [frontend, backend] = await $.all(
     *   [$`deno task build frontend`, $`deno task build backend`],
     *   (b) => b.text(),
     * );
     * ```
     */
    all<TResult>(builders: readonly CommandBuilder[], transform: (builder: CommandBuilder) => TResult | PromiseLike<TResult>): Promise<Awaited<TResult>[]>;
    /** Re-export of `jsr:@david/which` for getting the path to an executable. */
    which: Which;
    /** Similar to `which`, but synchronously. */
    whichSync: WhichSync;
}
/** @internal */
type ExtrasObject = Record<string, (...args: any[]) => unknown>;
/** Options for creating a custom `$`. */
export interface Create$Options<TExtras extends ExtrasObject> {
    /** Uses the state of this command builder as a starting point or
     * provide a function to build off the current builder.
     */
    commandBuilder?: CommandBuilder | ((builder: CommandBuilder) => CommandBuilder);
    /** Uses the state of this request builder as a starting point or
     * provide a function to build off the current builder.
     */
    requestBuilder?: RequestBuilder | ((builder: RequestBuilder) => RequestBuilder);
    /** Extra properties to put on the `$`. */
    extras?: TExtras;
}
/**
 * Builds a new `$` which will use the state of the provided
 * builders as the default.
 *
 * This can be useful if you want different default settings.
 *
 * Example:
 *
 * ```ts
 * import { build$ } from "dax";
 *
 * const commandBuilder = new CommandBuilder()
 *   .cwd("./subDir")
 *   .env("HTTPS_PROXY", "some_value");
 * const requestBuilder = new RequestBuilder()
 *   .header("SOME_VALUE", "value");
 *
 * const $ = build$({
 *   commandBuilder,
 *   requestBuilder,
 *   // optional additional functions to add to `$`
 *   extras: {
 *     add(a: number, b: number) {
 *       return a + b;
 *     },
 *   },
 * });
 *
 * // this command will use the env described above, but the main
 * // process and default `$` won't have its environment changed
 * await $`deno run my_script.ts`;
 *
 * // similarly, this will have the headers that were set in the request builder
 * const data = await $.request("https://plugins.dprint.dev/info.json").json();
 *
 * // use the extra function we defined
 * console.log($.add(1, 2));
 * ```
 */
export declare function build$<TExtras extends ExtrasObject = {}>(options?: Create$Options<TExtras>): $Type<TExtras>;
/**
 * Default `$` instance where commands may be executed.
 */
export declare const $: $Type;
export default $;
/** @internal */
declare function createPath(path: string | URL | Path): Path;
//# sourceMappingURL=mod.d.ts.map