|
20 | 20 | export PATH="$HOME/.local/bin:$PATH" |
21 | 21 | fi |
22 | 22 |
|
23 | | -# Ensure mise is activated in shell RC files |
24 | | -activate_mise_in_shell() { |
25 | | - local rc_file="$1" |
26 | | - # shellcheck disable=SC2016 # Intentionally single-quoted: written literally to RC file |
27 | | - local activation_line='eval "$(mise activate)"' |
28 | | - |
29 | | - if [ -f "$rc_file" ]; then |
30 | | - if ! grep -qF "mise activate" "$rc_file"; then |
31 | | - { |
32 | | - echo "" |
33 | | - echo "# mise version manager" |
34 | | - echo "$activation_line" |
35 | | - } >> "$rc_file" |
36 | | - echo " Added mise activation to $rc_file" |
37 | | - fi |
38 | | - fi |
39 | | -} |
40 | | - |
41 | | -# Detect which shell RC files exist and activate mise in them |
42 | | -if [ -f "$HOME/.zshrc" ]; then |
43 | | - activate_mise_in_shell "$HOME/.zshrc" |
44 | | -fi |
45 | | - |
46 | | -if [ -f "$HOME/.bashrc" ]; then |
47 | | - activate_mise_in_shell "$HOME/.bashrc" |
| 23 | +# Ensure mise is activated in ~/.zshrc |
| 24 | +if [ ! -f "$HOME/.zshrc" ]; then |
| 25 | + touch "$HOME/.zshrc" |
48 | 26 | fi |
49 | 27 |
|
50 | | -# If neither exists, create .bashrc with mise activation (Linux default) |
51 | | -if [ ! -f "$HOME/.zshrc" ] && [ ! -f "$HOME/.bashrc" ]; then |
52 | | - echo '# mise version manager' > "$HOME/.bashrc" |
53 | | - # shellcheck disable=SC2016 # Intentionally single-quoted: written literally to RC file |
54 | | - echo 'eval "$(mise activate)"' >> "$HOME/.bashrc" |
55 | | - echo " Created $HOME/.bashrc with mise activation" |
| 28 | +if ! grep -qF "mise activate" "$HOME/.zshrc"; then |
| 29 | + { |
| 30 | + echo "" |
| 31 | + echo "# mise version manager" |
| 32 | + # shellcheck disable=SC2016 # Intentionally single-quoted: written literally to RC file |
| 33 | + echo 'eval "$(mise activate)"' |
| 34 | + } >> "$HOME/.zshrc" |
| 35 | + echo " Added mise activation to ~/.zshrc" |
56 | 36 | fi |
57 | 37 |
|
58 | 38 | # Activate mise for this session |
|
0 commit comments