Skip to main content

CDPath

Specify the same cd search paths cross shell.

Syntaxโ€‹

cdpath:
- value: |
{{ .Home }}/src
{{ .Home }}/work
if: match .Shell "bash" "zsh" "fish" "tcsh" "xonsh"
- value: |
{{ .Home }}/sandbox
ifExists: true
force: true

CDPathโ€‹

  • value (string): directory entries to add, separated by newlines. Supports templating.
  • if (string): golang template conditional statement, see if.
  • force (boolean): always export the entry even when already present in the current shell.
  • ifExists (boolean): add only entries that exist on disk (default: false).

Shell behavior:

ShellSupportedImplementation
bashYesAppends to the CDPATH environment variable
zshYesAppends to the cdpath shell variable
fishYesAppends using set -g cdpath $cdpath <value>
tcshYesAppends to the cdpath shell variable
xonshYesAppends to $CDPATH
cmdNoSkipped
pwshNoSkipped
powershellNoSkipped
nuNoSkipped

High-level behavior:

  • aliae uses shell-native cd search path mechanisms where available.
  • Each configured entry is appended to the active shell's CDPATH/cdpath representation.
  • aliae prepends . when needed so local-directory fallback remains available.
  • Duplicate entries are suppressed and existing shell values are preserved.
  • ifExists and force work the same way as they do for path.

cdpath entries follow the same duplicate suppression and path normalization behavior as path.

Expected output by shellโ€‹

The examples below use:

cdpath:
- value: /usr/local/share
export CDPATH="${CDPATH:+$CDPATH:}/usr/local/share"

cdpath output is not emitted for cmd, pwsh, powershell, or nu.