xonsh.dirstack

Directory stack and associated utilities for the xonsh shell. https://www.gnu.org/software/bash/manual/html_node/Directory-Stack-Builtins.html

xonsh.dirstack.cd(args, stdin=None)[source]

Changes the directory.

If no directory is specified (i.e. if args is None) then this changes to the current user’s home directory.

xonsh.dirstack.dirs_fn(nth: Annotated[str | None, (), 'metavar', 'N', 'nargs', '?', 'completer', None] = None, clear=False, print_long=False, verbose=False, long=False)[source]

Manage the list of currently remembered directories.

Parameters:
nth

Displays the Nth directory (counting from the left/right according to +/x prefix respectively), starting with zero

clear-c

Clears the directory stack by deleting all of the entries.

print_long-p

Print the directory stack with one entry per line.

verbose-v

Print the directory stack with one entry per line, prefixing each entry with its index in the stack.

long-l

Produces a longer listing; the default listing format uses a tilde to denote the home directory.

xonsh.dirstack.popd_fn(nth: Annotated[str | None, (), 'metavar', '+N|-N', 'nargs', '?', 'completer', None] = None, cd=True, quiet=False)[source]

When no arguments are given, popd removes the top directory from the stack and performs a cd to the new top directory. The elements are numbered from 0 starting at the first directory listed with dirs; that is, popd is equivalent to popd +0.

Parameters:
cd-n, –cd

Suppresses the normal change of directory when removing directories from the stack, so that only the stack is manipulated.

nth

Removes the Nth directory (counting from the left/right of the list printed by dirs w.r.t. -/+ prefix), starting with zero.

quiet-q, –quiet

Do not call dirs, regardless of $PUSHD_SILENT

xonsh.dirstack.pushd_fn(dir_or_n: Annotated[str | None, (), 'metavar', '+N|-N|dir', 'nargs', '?', 'completer', None] = None, cd=True, quiet=False)[source]

Adds a directory to the top of the directory stack, or rotates the stack, making the new top of the stack the current working directory.

On Windows, if the path is a UNC path (begins with \<server><share>) and if the DisableUNCCheck registry value is not enabled, creates a temporary mapped drive letter and sets the working directory there, emulating behavior of PUSHD in CMD.EXE

Parameters:
dir_or_n
  • dir :

    Makes dir be the top of the stack, making it the new current directory as if it had been supplied as an argument to the cd builtin.

  • +N :

    Brings the Nth directory (counting from the left of the list printed by dirs, starting with zero) to the top of the list by rotating the stack.

  • -N :

    Brings the Nth directory (counting from the right of the list printed by dirs, starting with zero) to the top of the list by rotating the stack.

cd-n, –cd

Suppresses the normal change of directory when adding directories to the stack, so that only the stack is manipulated.

quiet-q, –quiet

Do not call dirs, regardless of $PUSHD_SILENT

xonsh.dirstack.with_pushd(d)[source]

Use pushd as a context manager

xonsh.dirstack.DIRSTACK: list[str] = []

A list containing the currently remembered directories.