File tree Expand file tree Collapse file tree 1 file changed +28
-6
lines changed
Expand file tree Collapse file tree 1 file changed +28
-6
lines changed Original file line number Diff line number Diff line change @@ -4,13 +4,35 @@ if [ ! -L "${HOME}/.config/dotfiles" ]; then
44fi
55export COLORTERM=truecolor
66
7- # If the first argument is -c, shift it off
8- if [ " $1 " = " -c" ]; then
9- shift
10- fi
7+ # Parse flags
8+ zsh_flags=" "
9+ has_c_flag=0
1110
12- if [ " $# " -eq 0 ]; then
11+ while [ " $# " -gt 0 ]; do
12+ case " $1 " in
13+ -l|-i|-s)
14+ zsh_flags=" $zsh_flags $1 "
15+ shift
16+ ;;
17+ -c)
18+ has_c_flag=1
19+ shift
20+ # Continue parsing for more flags
21+ ;;
22+ * )
23+ # First non-flag argument
24+ break
25+ ;;
26+ esac
27+ done
28+
29+ if [ " $has_c_flag " -eq 1 ] && [ " $# " -gt 0 ]; then
30+ # First arg is the command, rest are passed through
31+ user_cmd=" $1 "
32+ shift
33+ exec zsh $zsh_flags -c " source ${HOME} /.dotfiles/dotfiles.sh && dotfiles source && { $user_cmd ; }" " $@ "
34+ elif [ " $# " -eq 0 ]; then
1335 exec zsh --login
1436else
15- exec zsh -c " dotfiles source; $* "
37+ exec zsh " $@ "
1638fi
You can’t perform that action at this time.
0 commit comments