-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig
More file actions
executable file
·50 lines (43 loc) · 1.31 KB
/
config
File metadata and controls
executable file
·50 lines (43 loc) · 1.31 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
#!/bin/bash
# Global dotfiles config command
# Usage: config <command> [args...]
# Find dotfiles directory
DOTFILES_DIR=""
# Try to find dotfiles directory in common locations
if [[ -f "$HOME/.dotfiles_path" ]]; then
DOTFILES_DIR=$(cat "$HOME/.dotfiles_path")
elif [[ -d "$HOME/dotfiles" ]]; then
DOTFILES_DIR="$HOME/dotfiles"
elif [[ -d "$HOME/.dotfiles" ]]; then
DOTFILES_DIR="$HOME/.dotfiles"
elif [[ -d "$HOME/code/dotfiles" ]]; then
DOTFILES_DIR="$HOME/code/dotfiles"
else
echo "❌ Cannot find dotfiles directory"
echo "Create ~/.dotfiles_path with the path to your dotfiles, or ensure dotfiles are in:"
echo " ~/dotfiles, ~/.dotfiles, or ~/code/dotfiles"
exit 1
fi
# Verify dotfiles directory exists and has Makefile
if [[ ! -d "$DOTFILES_DIR" ]] || [[ ! -f "$DOTFILES_DIR/Makefile" ]]; then
echo "❌ Invalid dotfiles directory: $DOTFILES_DIR"
echo "Directory must contain a Makefile"
exit 1
fi
# Change to dotfiles directory and run make
cd "$DOTFILES_DIR" || exit 1
# If no arguments, show help
if [[ $# -eq 0 ]]; then
make help
exit 0
fi
# Handle compound commands
if [[ "$1" == "env" && "$2" == "set" ]]; then
make env-set
elif [[ "$1" == "env" ]]; then
# Just 'env' with no other args
make env
else
# Pass all arguments to make as-is
make "$@"
fi