From a257296262470499a8bd30d879fc78bc8fc2b2b0 Mon Sep 17 00:00:00 2001 From: kevin zhuang Date: Tue, 7 Apr 2020 16:11:57 +1000 Subject: [PATCH] dislay modify status --- scripts/fadd | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/fadd b/scripts/fadd index cf0ca90..fee1e9d 100755 --- a/scripts/fadd +++ b/scripts/fadd @@ -72,9 +72,11 @@ elif [[ -n "${new_folder}" ]]; then stage_file "${line}" done <<< "${new_folder}" else - selected_files=$(/usr/bin/git --git-dir="${DOTBARE_DIR}" --work-tree="${DOTBARE_TREE}" diff --name-only | \ - fzf --multi --exit-0 --preview "/usr/bin/git --git-dir="${DOTBARE_DIR}" --work-tree="${DOTBARE_TREE}" diff --color=always $HOME/{}" | \ - awk -v home=$HOME '{print home "/" $0}') + selected_files=$(/usr/bin/git --git-dir="${DOTBARE_DIR}" --work-tree="${DOTBARE_TREE}" diff --name-status | \ + awk '{if ($1 == "D") {print "\033[31m" $1 " " $2} else {print "\033[33m" $1 " " $2}}' | \ + fzf --ansi --multi --exit-0 --preview "echo {} | awk '{print \$2}' | \ + xargs -I __ /usr/bin/git --git-dir="${DOTBARE_DIR}" --work-tree="${DOTBARE_TREE}" diff --color=always $HOME/__" | \ + awk -v home=$HOME '{print home "/" $2}') while IFS= read -r line; do stage_file "${line}" done <<< "${selected_files}"