File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -70,6 +70,10 @@ if [ "${YOLOALIAS:-false}" = "true" ]; then
7070 fi
7171
7272 touch " $rc_file "
73+ # Ensure the file ends with a newline before appending
74+ if [ -s " $rc_file " ] && [ " $( tail -c 1 " $rc_file " | wc -l) " -eq 0 ]; then
75+ printf ' \n' >> " $rc_file "
76+ fi
7377 printf ' %s\n' " $alias_cmd " >> " $rc_file "
7478 }
7579
@@ -82,6 +86,7 @@ if [ "${YOLOALIAS:-false}" = "true" ]; then
8286 # fish — create a function file (idiomatic for fish)
8387 FISH_FUNC_DIR=" $TARGET_HOME /.config/fish/functions"
8488 FISH_FUNC_FILE=" $FISH_FUNC_DIR /yolo.fish"
89+ FISH_CREATED=false
8590 if [ -f " $FISH_FUNC_FILE " ]; then
8691 echo " Skipping $FISH_FUNC_FILE : function already exists."
8792 else
@@ -91,12 +96,15 @@ function yolo --description "claude --allow-dangerously-skip-permissions"
9196 claude --allow-dangerously-skip-permissions $argv
9297end
9398FISHEOF
99+ FISH_CREATED=true
94100 fi
95101
96102 # Fix ownership if installing for non-root user
97103 if [ -n " $_REMOTE_USER " ] && [ " $_REMOTE_USER " != " root" ]; then
98104 chown " $_REMOTE_USER " " $TARGET_HOME /.bashrc" " $TARGET_HOME /.zshrc"
99- chown " $_REMOTE_USER " " $FISH_FUNC_FILE "
105+ if [ " $FISH_CREATED " = true ]; then
106+ chown " $_REMOTE_USER " " $TARGET_HOME /.config" " $TARGET_HOME /.config/fish" " $FISH_FUNC_DIR " " $FISH_FUNC_FILE "
107+ fi
100108 fi
101109
102110 echo " yolo alias configured for bash, zsh, and fish."
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ check "yolo alias in zshrc" bash -c "grep -Fq 'claude --allow-dangerously-skip-p
1515check " fish yolo function body" bash -c " test -f ~/.config/fish/functions/yolo.fish && grep -Fq 'claude --allow-dangerously-skip-permissions' ~/.config/fish/functions/yolo.fish"
1616check " bashrc owned by current user" bash -c " test \" $( stat -c ' %U' ~ /.bashrc) \" = \" $( whoami) \" "
1717check " zshrc owned by current user" bash -c " test \" $( stat -c ' %U' ~ /.zshrc) \" = \" $( whoami) \" "
18+ check " fish functions dir owned by current user" bash -c " test \" $( stat -c ' %U' ~ /.config/fish/functions) \" = \" $( whoami) \" "
1819check " fish function owned by current user" bash -c " test \" $( stat -c ' %U' ~ /.config/fish/functions/yolo.fish) \" = \" $( whoami) \" "
1920check " yolo resolves in bash" bash -ic " type yolo"
2021
You can’t perform that action at this time.
0 commit comments