refactor(fgrep): adjust function name to be more readable

pull/21/head
Kevin Zhuang 4 years ago
parent 1a394c2355
commit a2b894aa4b

@ -200,8 +200,8 @@ function get_stash() {
# the selected file name with it's line number and line, seperated by ":"
# e.g. .bash_profile:1:echo hello
#######################################
function grep_lines() {
local header="${1:-select lines to edit}"
function grep_words() {
local header="${1:-select matches to edit}"
set_fzf_multi "$2"
cd "${DOTBARE_TREE}" || exit
git --git-dir="${DOTBARE_DIR}" --work-tree="${DOTBARE_TREE}" \

@ -19,7 +19,7 @@ source "${mydir}"/../helper/git_query.sh
function usage() {
echo -e "Usage: dotbare fgrep [-h] ...
Grep words within tracked files and select to edit them through fzf.
Grep words within tracked files and select to edit matches.
Optional arguments:
-h, --help\t\tshow this help message and exit."
@ -52,7 +52,7 @@ while IFS= read -r line; do
selected_lines+=("${line}")
;;
esac
done < <(grep_lines)
done < <(grep_words)
[[ "${#selected_lines[@]}" -eq 0 ]] && exit 1

@ -28,5 +28,5 @@ edit_lines() {
@test "fgrep edit lines" {
run edit_lines
[[ "${output}" =~ "fgrep_lines" ]]
[[ "${output}" =~ "fgrep_words" ]]
}

@ -62,7 +62,7 @@ elif [[ "$*" =~ '--header=select stash to apply' ]] && [[ "$*" =~ "show -p __ --
echo "fstash_apply"
elif [[ "$*" =~ '--delimiter : --nth 3..' ]]; then
# dotbare fgrep -- "./fgrep.bats" @test "fgrep edit lines"
echo "fgrep_lines"
echo "fgrep_words"
else
echo "$@"
fi

Loading…
Cancel
Save