From 78ded00847c4f19ac8a862919d1fce521262d14e Mon Sep 17 00:00:00 2001 From: Tw93 Date: Fri, 2 Jan 2026 01:56:20 +0000 Subject: [PATCH] chore: auto format code --- bin/completion.sh | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/bin/completion.sh b/bin/completion.sh index 33a620c..ad72ffe 100755 --- a/bin/completion.sh +++ b/bin/completion.sh @@ -37,7 +37,7 @@ if [[ $# -eq 0 ]]; then # Detect current shell current_shell="${SHELL##*/}" if [[ -z "$current_shell" ]]; then - current_shell="$(ps -p "$PPID" -o comm= 2>/dev/null | awk '{print $1}')" + current_shell="$(ps -p "$PPID" -o comm= 2> /dev/null | awk '{print $1}')" fi completion_name="" @@ -69,9 +69,9 @@ if [[ $# -eq 0 ]]; then esac if [[ -z "$completion_name" ]]; then - if [[ -f "$config_file" ]] && grep -Eq "(^# Mole shell completion$|(mole|mo)[[:space:]]+completion)" "$config_file" 2>/dev/null; then + if [[ -f "$config_file" ]] && grep -Eq "(^# Mole shell completion$|(mole|mo)[[:space:]]+completion)" "$config_file" 2> /dev/null; then original_mode="" - original_mode="$(stat -f '%Mp%Lp' "$config_file" 2>/dev/null || true)" + original_mode="$(stat -f '%Mp%Lp' "$config_file" 2> /dev/null || true)" temp_file="$(mktemp)" grep -Ev "(^# Mole shell completion$|(mole|mo)[[:space:]]+completion)" "$config_file" > "$temp_file" || true mv "$temp_file" "$config_file" @@ -86,9 +86,9 @@ if [[ $# -eq 0 ]]; then fi # Check if already installed and normalize to latest line - if [[ -f "$config_file" ]] && grep -Eq "(mole|mo)[[:space:]]+completion" "$config_file" 2>/dev/null; then + if [[ -f "$config_file" ]] && grep -Eq "(mole|mo)[[:space:]]+completion" "$config_file" 2> /dev/null; then original_mode="" - original_mode="$(stat -f '%Mp%Lp' "$config_file" 2>/dev/null || true)" + original_mode="$(stat -f '%Mp%Lp' "$config_file" 2> /dev/null || true)" temp_file="$(mktemp)" grep -Ev "(^# Mole shell completion$|(mole|mo)[[:space:]]+completion)" "$config_file" > "$temp_file" || true mv "$temp_file" "$config_file" @@ -119,8 +119,7 @@ if [[ $# -eq 0 ]]; then echo -e "${YELLOW}Cancelled${NC}" exit 0 ;; - "" | $'\n' | $'\r' | [Yy]) - ;; + "" | $'\n' | $'\r' | [Yy]) ;; *) log_error "Invalid key" exit 1 @@ -136,7 +135,7 @@ if [[ $# -eq 0 ]]; then # Remove previous Mole completion lines to avoid duplicates if [[ -f "$config_file" ]]; then original_mode="" - original_mode="$(stat -f '%Mp%Lp' "$config_file" 2>/dev/null || true)" + original_mode="$(stat -f '%Mp%Lp' "$config_file" 2> /dev/null || true)" temp_file="$(mktemp)" grep -Ev "(^# Mole shell completion$|(mole|mo)[[:space:]]+completion)" "$config_file" > "$temp_file" || true mv "$temp_file" "$config_file"