Skip to content

Dirs

Index

dirs::exists

Return true if the given path exists and is a directory.

Arguments

  • $1 (dir): path

Exit codes

  • 0: if true
  • 1: if false

dirs::assert_exists

Die if the given directory does not exist.

Arguments

  • $1 (dir): path

Exit codes

  • 0: if true
  • 1: if false

dirs::create

Create each given directory (and any missing parents) if it does not already exist.

Arguments

  • ... (target): directory paths

dirs::is_personal_project

Return true if the given directory is the same as, or nested under, ${PERSONAL_PROJECTS_DIR}. Symlinks are resolved on both sides via realpath before comparison. The argument path need not exist.

Arguments

  • $1 (dir): path

dirs::assert_personal_project

Die if the given directory is not under ${PERSONAL_PROJECTS_DIR}.

Arguments

  • $1 (dir): path

Exit codes

  • 0: if true
  • 1: if false

dirs::root_create

Create each given directory (and any missing parents) as root if it does not already exist.

Arguments

  • ... (target): directory paths