-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeveloper.sh
More file actions
37 lines (34 loc) · 1.16 KB
/
Copy pathdeveloper.sh
File metadata and controls
37 lines (34 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
DEVELOPER_DIR="$HOME/Developer"
if [ -d "$DEVELOPER_DIR" ]; then
# Change directory helper for ~/Developer.
dcd() {
# No arguments should result in just entering the developer dir itself.
local target="$DEVELOPER_DIR/$1"
if [ "$#" -gt 1 ]; then
echo "<!> ERROR: Too many arguments." >&2
return 1
elif [ ! -d "$target" ]; then
echo "<!> ERROR: $target does not exist." >&2
return 1
fi
cd "$target" || return 1
}
# VSCode launcher helper for ~/Developer, loaded if code command exists.
if command -v code >/dev/null 2>&1; then
dcode() {
local target="$DEVELOPER_DIR/$1"
if [ "$#" -lt 1 ]; then
echo "<!> ERROR: Must specify developer directory to open." >&2
return 1
elif [ "$#" -gt 1 ]; then
echo "<!> ERROR: Too many arguments." >&2
return 1
elif [ ! -d "$target" ]; then
echo "<!> ERROR: $target does not exist." >&2
return 1
fi
code "$target" || return 1
}
fi
fi