Repository navigation
Expand file tree
/
Copy pathjustfile
More file actions
106 lines (93 loc) · 3.17 KB
/
Copy pathjustfile
File metadata and controls
106 lines (93 loc) · 3.17 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# Justfile for Dotfiles using GNU Stow
set shell := ["bash", "-euo", "pipefail", "-c"]
target := env("HOME")
# All stow packages (explicit to avoid stowing non-package dirs)
packages := "fastfetch ghostty git opencode starship zsh agents"
# Default recipe: show available commands
default:
@just --list
# Restow all packages
[doc("Restow every package")]
all:
@for pkg in {{ packages }}; do \
echo "Restowing $pkg"; \
stow --verbose --target={{ target }} --restow "$pkg"; \
done
# Install (restow) one or more packages
[doc("Install packages: just install git ghostty zsh")]
install +pkgs:
@for pkg in {{ pkgs }}; do \
if [ ! -d "$pkg" ]; then \
echo "Error: Package '$pkg' does not exist"; \
exit 1; \
fi; \
echo "Installing $pkg"; \
stow --verbose --target={{ target }} --restow "$pkg"; \
done
# Dry-run install to preview what would change
[doc("Preview install: just dry-run ghostty")]
dry-run +pkgs:
@for pkg in {{ pkgs }}; do \
if [ ! -d "$pkg" ]; then \
echo "Error: Package '$pkg' does not exist"; \
exit 1; \
fi; \
echo "=== Dry-run: $pkg ==="; \
stow --verbose --target={{ target }} --no --restow "$pkg" 2>&1 || true; \
done
# Adopt existing files into stow packages then restow
[doc("Adopt existing files: just adopt git")]
adopt +pkgs:
@for pkg in {{ pkgs }}; do \
if [ ! -d "$pkg" ]; then \
echo "Error: Package '$pkg' does not exist"; \
exit 1; \
fi; \
echo "Adopting $pkg"; \
stow --verbose --target={{ target }} --adopt "$pkg"; \
done
# Delete all symlinks (with confirmation)
[doc("Remove all symlinks")]
[confirm("This will remove ALL symlinks. Continue? (y/n)")]
delete:
@for pkg in {{ packages }}; do \
echo "Deleting $pkg"; \
stow --verbose --target={{ target }} --delete "$pkg"; \
done
# Uninstall (unlink) one or more packages
[doc("Uninstall packages: just uninstall git ghostty")]
uninstall +pkgs:
@for pkg in {{ pkgs }}; do \
if [ ! -d "$pkg" ]; then \
echo "Error: Package '$pkg' does not exist"; \
exit 1; \
fi; \
echo "Uninstalling $pkg"; \
stow --verbose --target={{ target }} --delete "$pkg"; \
done
# Scaffold a new stow package
[doc("Create new package: just init alacritty")]
init pkg:
@if [ -d "{{ pkg }}" ]; then \
echo "Error: Package '{{ pkg }}' already exists"; \
exit 1; \
fi
mkdir -p "{{ pkg }}"
@echo "Created package '{{ pkg }}/' — add your dotfiles then run: just install {{ pkg }}"
@echo "Don't forget to add '{{ pkg }}' to the packages list in justfile"
# List all available packages
[doc("List available packages")]
list:
@echo "Available packages:"
@for pkg in {{ packages }}; do \
echo " - $pkg"; \
done
# Show what would be stowed for each package (dry-run)
[doc("Dry-run: show what would be stowed")]
status:
@echo "Package status (dry-run):"
@for pkg in {{ packages }}; do \
echo ""; \
echo "Package: $pkg"; \
stow --verbose --target={{ target }} --no "$pkg" 2>&1 || true; \
done