11#! /usr/bin/env zsh
2- # proj-jumper — jump to a project inside $DEV_ROOT
3-
4- # --- configuration ----------------------------------------------------------
5- : ${DEV_ROOT:= ${PROJ_DEV_ROOT:- " /Volumes/dog_house/development/projects" } }
2+ # proj-jumper — jump quickly into a project directory under $DEV_ROOT
3+ # v0.1.3-dev
64
5+ # -------- configuration ------
6+ : ${DEV_ROOT:= ${PROJ_DEV_ROOT:- " ~/development" } }
77# allow users to export PROJ_DEV_ROOT or DEV_ROOT to override
88export DEV_ROOT
99
10- # --- function ---------------------------------------------------------------
10+ # ───────── help text ─────────
11+ _proj_usage () {
12+ cat << EOF
13+ proj-jumper — jump to project directories
14+
15+ Usage:
16+ proj <name> cd into the project called <name>
17+ proj interactive picker (fzf if available, else list)
18+ proj -h | --help show this help
19+
20+ Options:
21+ -h, --help display this help and exit
22+
23+ Environment variables:
24+ PROJ_DEV_ROOT override the default root path ($DEV_ROOT )
25+ DEV_ROOT same as above (kept for compatibility)
26+
27+ Examples:
28+ proj savage → cd \$ DEV_ROOT/savage
29+ proj → fuzzy-select a project
30+ proj-config ~/code → write export PROJ_DEV_ROOT=~/code to ~/.zshrc
31+ EOF
32+ }
33+
34+
35+ # ───────── main command ─────────
1136proj () {
37+ # 0. help first
38+ [[ " $1 " == " -h" || " $1 " == " --help" ]] && { _proj_usage; return 0 }
39+
1240 # 1. verify disk
1341 [[ -d $DEV_ROOT ]] || { print -u2 " ⚠️ $DEV_ROOT not found" ; return 1 }
1442
@@ -31,7 +59,7 @@ proj () {
3159 fi
3260}
3361
34- # ---------------------------------- config helper
62+ # ───────── config helper ─────────
3563proj-config () {
3664 local new_root=${1:- }
3765 [[ -z $new_root ]] && {
@@ -52,7 +80,7 @@ proj-config () {
5280}
5381compdef _files proj-config # tab-complete directories
5482
55- # --- completion hook --------------------------------------------------------
83+ # ─────── completion helpers ───────
5684# Late-bound because the volume could mount after shell start
5785_proj_complete () {
5886 [[ -d $DEV_ROOT ]] || return
0 commit comments