alpha
Login
or
Join now
xcc.es
/
dotfiles
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
[READ-ONLY] Mirror of https://github.com/mrgnw/dotfiles. My shell customizations - aliases, functions, and themes.
dotfiles
shell
zinit
zsh
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
Update dev.zsh
author
Morgan Williams
date
4 months ago
(Mar 17, 2026, 8:08 PM +0100)
commit
d9b70277
d9b70277d1644202a59faea58459068f135ca3fc
parent
850d2c20
850d2c2086769f256a98e4101b34d04c3fa3c7a0
-75
1 changed file
Expand all
Collapse all
Unified
Split
dev.zsh
-75
dev.zsh
View file
Reviewed
···
1
1
-
# infer tool from current directory
2
2
-
get_tool() {
3
3
-
if [[ -f pyproject.toml ]]; then
4
4
-
echo "uv"
5
5
-
elif [[ -f package.json ]]; then
6
6
-
echo "bun"
7
7
-
elif [[ -f Package.swift ]]; then
8
8
-
echo "swift"
9
9
-
elif [[ -f main.go ]]; then
10
10
-
echo "go"
11
11
-
elif [[ -f compose.yml || -f compose.yaml ]]; then
12
12
-
echo "docker-compose"
13
13
-
elif [[ -f docker-compose.yml || -f docker-compose.yaml ]]; then
14
14
-
echo "docker-compose"
15
15
-
else
16
16
-
echo ""
17
17
-
fi
18
18
-
}
19
19
-
20
20
-
# Define the command for each tool & operation (+-«»)
21
21
-
map_tool_command() {
22
22
-
local tool=$1
23
23
-
local operation=$2
24
24
-
25
25
-
case $tool in
26
26
-
uv)
27
27
-
case $operation in
28
28
-
+) echo "add" ;;
29
29
-
-) echo "remove" ;;
30
30
-
») echo "run" ;;
31
31
-
«) echo "sync" ;;
32
32
-
esac
33
33
-
;;
34
34
-
bun|swift|go)
35
35
-
case $operation in
36
36
-
+) echo "add" ;;
37
37
-
-) echo "remove" ;;
38
38
-
») echo "run" ;;
39
39
-
«) echo "update" ;;
40
40
-
esac
41
41
-
;;
42
42
-
docker-compose)
43
43
-
case $operation in
44
44
-
+) echo "pull" ;;
45
45
-
-) echo "down" ;;
46
46
-
») echo "up" ;;
47
47
-
«) echo "pull" ;;
48
48
-
esac
49
49
-
;;
50
50
-
brew)
51
51
-
case $operation in
52
52
-
+) echo "install" ;;
53
53
-
-) echo "uninstall" ;;
54
54
-
») echo "upgrade" ;;
55
55
-
«) echo "update" ;;
56
56
-
esac
57
57
-
;;
58
58
-
esac
59
59
-
}
60
60
-
61
61
-
run_tool_command() {
62
62
-
local operation=$1
63
63
-
shift
64
64
-
local tool=$(get_tool)
65
65
-
echo $tool
66
66
-
tool=${tool:-brew}
67
67
-
command=$(map_tool_command $tool $operation)
68
68
-
echo "$tool $command" "$@"
69
69
-
$tool $command "$@"
70
70
-
}
71
71
-
72
72
-
+() { run_tool_command + "$@" }
73
73
-
-() { run_tool_command - "$@" }
74
74
-
«() { run_tool_command « "$@" }
75
75
-
»() { run_tool_command » "$@" }