@visulima/ansi
Version:
ANSI escape codes for some terminal swag.
27 lines (26 loc) • 1.17 kB
TypeScript
/**
* Returns a sequence that reports the current working directory to the terminal.
*
* Terminals such as iTerm2, WezTerm and others use this `OSC 7` sequence to keep
* track of the shell's working directory — for example to open new tabs/splits in
* the same directory. The payload is a `file://` URL built from the optional
* `host` and the joined `paths`.
*
* Sequence: `OSC 7 ; file://[host]/[path] BEL`
* @param host The host portion of the `file://` URL (use an empty string for the local machine).
* @param paths One or more path segments that are joined into the URL path.
* @returns The `OSC 7` escape sequence.
* @example
* ```typescript
* import { notifyWorkingDirectory } from "@visulima/ansi/cwd";
*
* process.stdout.write(notifyWorkingDirectory("", process.cwd()));
* ```
* @see {@link https://gitlab.freedesktop.org/terminal-wg/specifications/-/issues/20}
*/
declare const notifyWorkingDirectory: (host: string, ...paths: string[]) => string;
/**
* Alias for {@link notifyWorkingDirectory}.
*/
declare const setWorkingDirectory: (host: string, ...paths: string[]) => string;
export { notifyWorkingDirectory, setWorkingDirectory };