2020-06-22 00:05:26 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
|
|
|
# This script is for mocking fzf for testing,
|
|
|
|
# it will stop fzf for goin into a interactive mode
|
|
|
|
#
|
|
|
|
# usage:
|
|
|
|
# export PATH="${BATS_TEST_DIRNAME}:$PATH"
|
|
|
|
|
2020-07-07 03:43:51 +00:00
|
|
|
if [[ "$*" =~ '--multi --preview ' ]] && [[ "$*" =~ "tree -L 1 -C --dirsfirst {}" ]]; then
|
|
|
|
# dotbare fadd --dir -- "./fadd.bats" @test "fadd stage selected dir"
|
|
|
|
echo "fadd_stage_dir"
|
|
|
|
elif [[ "$*" =~ '--multi --preview' ]] && [[ "$*" =~ "preview.sh {}" ]]; then
|
|
|
|
# dotbare fadd -f -- "./fadd.bats" @test "fadd stage selected file"
|
|
|
|
echo "fadd_stage_file"
|
|
|
|
elif [[ "$*" =~ '--header=select files to stage' ]] && [[ "$*" =~ "diff HEAD --color=always" ]]; then
|
|
|
|
# dotbare fadd -- "./fadd.bats" @test "fadd stage modified files"
|
2020-07-07 05:20:31 +00:00
|
|
|
echo "-- fadd_stage_modified"
|
2020-07-07 03:43:51 +00:00
|
|
|
elif [[ "$*" =~ "--no-multi --header=select a branch to checkout" ]]; then
|
|
|
|
# dotbare fcheckout --branch -- "./fcheckout.bats" @test "fcheckout branch"
|
|
|
|
echo "fcheckout_branch"
|
|
|
|
elif [[ "$*" =~ "--header=select a commit to checkout" ]] && [[ "$*" =~ "show --color" ]]; then
|
|
|
|
# dotbare fcheckout --c -- "./fcheckout.bats" @test "fcheckout commit"
|
|
|
|
echo "fcheckout_commit"
|
|
|
|
elif [[ "$*" =~ "--header=select a file to checkout version in HEAD" ]] && [[ "$*" =~ "diff HEAD --color=always" ]]; then
|
|
|
|
# dotbare fcheckout -y -- "./fcheckout.bats" @test "fcheckout modified"
|
|
|
|
echo "-- fcheckout_modified"
|
|
|
|
elif [[ "$*" =~ '--header=select the target commit' ]] && [[ "$*" =~ "diff --color" ]]; then
|
|
|
|
# dotbare fcheckout --yes -s -- "./fcheckout.bats" @test "fcheckout select"
|
|
|
|
echo "fcheckout_select_commitdiff"
|
|
|
|
elif [[ "$*" =~ '--header=select a file to checkout' ]] && [[ "$*" =~ "preview.sh ${DOTBARE_TREE}/{}" ]]; then
|
|
|
|
# dotbare fcheckout --yes -s -- "./fcheckout.bats" @test "fcheckout select"
|
|
|
|
echo "fcheckout_select_gitfile"
|
2020-07-07 04:34:22 +00:00
|
|
|
elif [[ "$*" =~ "--header=select a commit to rename --no-multi" ]] && [[ "$*" =~ "show --color=always" ]]; then
|
|
|
|
# dotbare fedit --commit -- "./fedit.bats" @test "fedit edit commits"
|
|
|
|
echo "fedit_commits"
|
|
|
|
elif [[ "$*" =~ "--header=select tracked files to edit" ]]; then
|
|
|
|
# dotbare fedit -- "./fedit.bats" @test "fedit edit files"
|
2020-07-15 04:49:08 +00:00
|
|
|
echo "fedit_files"
|
2020-07-07 05:06:12 +00:00
|
|
|
elif [[ "$*" =~ '--header=select the target commit for HEAD --no-multi' ]] && [[ "$*" =~ "show --color" ]]; then
|
2020-07-07 03:43:51 +00:00
|
|
|
# dotbare freset --commit -y -- "./freset.bats" @test "freset select commit"
|
2020-07-07 05:06:12 +00:00
|
|
|
echo "freset_commit"
|
|
|
|
elif [[ "$*" =~ "--header=select files to unstage" ]] && [[ "$*" =~ "diff HEAD --color=always" ]]; then
|
|
|
|
# dotbare freset -- "./freset.bats" @test "freset select files"
|
|
|
|
echo "-- freset_file"
|
2020-07-07 04:58:43 +00:00
|
|
|
elif [[ "$*" =~ "--no-multi --header=commit --flog_reset" ]]; then
|
|
|
|
# dotbare flog -- "./flog.bats" @test "flog checkout routing"
|
|
|
|
echo "exit"
|
2020-07-07 03:43:51 +00:00
|
|
|
elif [[ "$*" =~ '--header=select a commit' ]] && [[ "$*" =~ "show --color" ]]; then
|
|
|
|
# dotbare flog --reset -y -- "./flog.bats" @test "flog reset"
|
|
|
|
echo "--flog_reset"
|
2020-07-07 05:18:43 +00:00
|
|
|
elif [[ "$*" =~ "--header=select files to untrack" ]] && [[ "$*" =~ "preview.sh ${DOTBARE_TREE}/{}" ]]; then
|
2020-07-07 03:43:51 +00:00
|
|
|
# dotbare funtrack -- "./funtrack.bats" @test "funtrack untrack file"
|
|
|
|
echo "funtrack_file"
|
|
|
|
elif [[ "$*" =~ '--header=select files to add to a stash' ]] && [[ "$*" =~ "diff HEAD --color=always" ]]; then
|
|
|
|
# dotbare fstash -s -- "./fstash.bats" @test "fstash stash select file"
|
|
|
|
echo "-- fstash_select"
|
|
|
|
elif [[ "$*" =~ '--header=select stash to delete' ]] && [[ "$*" =~ "show -p __ --color=always" ]]; then
|
|
|
|
# dotbare fstash --delete -- "./fstash.bats" @test "fstash stash delete"
|
|
|
|
echo "fstash_delete"
|
|
|
|
elif [[ "$*" =~ '--header=select stash to apply' ]] && [[ "$*" =~ "show -p __ --color=always" ]]; then
|
|
|
|
# dotbare fstash -- "./fstash.bats" @test "fstash apply stash"
|
|
|
|
echo "fstash_apply"
|
2020-07-15 04:49:08 +00:00
|
|
|
elif [[ "$*" =~ '--delimiter : --nth 3..' ]]; then
|
|
|
|
# dotbare fgrep -- "./fgrep.bats" @test "fgrep edit lines"
|
|
|
|
echo "fgrep_lines"
|
2020-07-07 03:43:51 +00:00
|
|
|
else
|
|
|
|
echo "$@"
|
|
|
|
fi
|