-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup
More file actions
executable file
·96 lines (84 loc) · 2.72 KB
/
Copy pathsetup
File metadata and controls
executable file
·96 lines (84 loc) · 2.72 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
#!/bin/sh
set -eu
repo_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
if [ -t 1 ]; then
blue=$(printf '\033[38;5;75m')
green=$(printf '\033[38;5;114m')
dim=$(printf '\033[2m')
bold=$(printf '\033[1m')
reset=$(printf '\033[0m')
else
blue= green= dim= bold= reset=
fi
case "${DOTFILES_PLATFORM:-}" in
arch) platform='Arch Linux' ;;
linux) platform='Linux' ;;
macos) platform='macOS' ;;
'')
case "$(uname -s)" in
Darwin) platform='macOS' ;;
Linux)
if [ -e /etc/arch-release ]; then platform='Arch Linux'; else platform='Linux'; fi
;;
*) platform='Unsupported' ;;
esac
;;
*) platform=${DOTFILES_PLATFORM} ;;
esac
printf '\n%s%s◆ Personal Environment Kit%s\n' "$bold" "$blue" "$reset"
printf '%s%sA small, direct and disposable-machine-friendly setup.%s\n\n' "$dim" "$green" "$reset"
printf ' Platform %s%s%s\n' "$bold" "$platform" "$reset"
printf ' Source %s\n\n' "$repo_dir"
printf '%sSelect one or more actions:%s\n\n' "$bold" "$reset"
printf ' %s1%s Core configurations\n' "$blue" "$reset"
printf ' %sZsh · Bash · Tmux · Navi · Mise · Starship%s\n\n' "$dim" "$reset"
printf ' %s2%s Personal configurations\n' "$blue" "$reset"
printf ' %sEditors · terminal · Yazi · Atuin · agent configs%s\n\n' "$dim" "$reset"
printf ' %s3%s Install selected tools\n' "$blue" "$reset"
printf ' %sCore Mise tools; Yazi packages when personal is selected%s\n\n' "$dim" "$reset"
printf ' %s4%s Run diagnostics after setup\n\n' "$blue" "$reset"
if [ -n "${DOTFILES_SETUP_SELECTION:-}" ]; then
selection=$DOTFILES_SETUP_SELECTION
printf ' Selection %s\n\n' "$selection"
else
printf 'Enter numbers separated by spaces %s[default: 1]%s: ' "$dim" "$reset"
IFS= read -r selection
selection=${selection:-1}
fi
core=false
personal=false
install=false
doctor=false
for item in $selection; do
case "$item" in
1) core=true ;;
2) personal=true ;;
3) install=true ;;
4) doctor=true ;;
*)
printf 'Unknown selection: %s\n' "$item" >&2
exit 2
;;
esac
done
scopes=
$core && scopes="$scopes core"
$personal && scopes="$scopes personal"
if $install; then
"$repo_dir/dotfiles" install core
fi
if [ -n "$scopes" ]; then
# Scope values are fixed words selected above.
# shellcheck disable=SC2086
"$repo_dir/dotfiles" apply $scopes
fi
if $install && $personal; then
"$repo_dir/dotfiles" install yazi
fi
if $doctor; then
doctor_scopes=$scopes
[ -n "$doctor_scopes" ] || doctor_scopes=' core'
# shellcheck disable=SC2086
"$repo_dir/dotfiles" doctor $doctor_scopes
fi
printf '\n%sDone.%s\n' "$green" "$reset"