Skip to content

Commit 00619f4

Browse files
committed
Fix dot environment
1 parent 11c2bd0 commit 00619f4

File tree

1 file changed

+28
-6
lines changed
  • bash/.local/bin

1 file changed

+28
-6
lines changed

bash/.local/bin/dot

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,35 @@ if [ ! -L "${HOME}/.config/dotfiles" ]; then
44
fi
55
export 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
1436
else
15-
exec zsh -c "dotfiles source; $*"
37+
exec zsh "$@"
1638
fi

0 commit comments

Comments
 (0)