1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
|
# (C) 2011-2025 magicant
# Completion script for the "git-bisect" command.
# Supports Git 2.48.1.
function completion/git-bisect {
WORDS=(git bisect "${WORDS[2,-1]}")
command -f completion//reexecute
}
function completion/git::bisect:arg {
typeset old new
old=$(git bisect terms --term-old 2>/dev/null) || old=good
new=$(git bisect terms --term-new 2>/dev/null) || new=bad
if [ ${WORDS[#]} -le 1 ]; then #>>#
complete -P "$PREFIX" -D "mark a commit as $old" "$old"
complete -P "$PREFIX" -D "mark a commit as $new" "$new"
complete -P "$PREFIX" -D "print help" help
complete -P "$PREFIX" -D "show the bisection log" log
complete -P "$PREFIX" -D "replay a bisection log" replay
complete -P "$PREFIX" -D "end bisection" reset
complete -P "$PREFIX" -D "start automated bisection" run
complete -P "$PREFIX" -D "mark a commit as untestable" skip
complete -P "$PREFIX" -D "start bisection" start
complete -P "$PREFIX" -D "show terms used in the current session" terms
complete -P "$PREFIX" -D "show remaining suspects with GUI" visualize view
#<<#
case ${TARGETWORD#"$PREFIX"} in (vie*)
complete -P "$PREFIX" -D "show remaining suspects with GUI" view
esac
else
WORDS=("${WORDS[2,-1]}")
typeset subcmd="${WORDS[1]}"
case $subcmd in
($old) subcmd=good ;;
($new) subcmd=bad ;;
esac
if command -vf "completion/git::bisect:$subcmd:arg" >/dev/null 2>&1; then
command -f "completion/git::bisect:$subcmd:arg"
fi
fi
}
function completion/git::bisect:bad:arg {
command -f completion/git::completeref
}
function completion/git::bisect:good:arg {
command -f completion/git::completeref
}
#function completion/git::bisect:help:arg {
#}
#function completion/git::bisect:log:arg {
#}
function completion/git::bisect:replay:arg {
complete -P "$PREFIX" -f
}
function completion/git::bisect:reset:arg {
command -f completion/git::completeref
}
function completion/git::bisect:run:arg {
WORDS=("${WORDS[2,-1]}")
command -f completion//reexecute -e
}
function completion/git::bisect:skip:arg {
command -f completion/git::completeref range=true
}
function completion/git::bisect:start:arg {
OPTIONS=( #>#
"--first-parent; follow only first parent of merge commits"
"--no-checkout; don't automatically check out commits to test"
"--term-old: --term-good:; specify a term for the old state"
"--term-new: --term-bad:; specify a term for the new state"
) #<#
command -f completion//parseoptions
case $ARGOPT in
(-)
command -f completion//completeoptions
;;
(--term-*)
;;
('')
command -f completion/git::completerefpath
;;
esac
}
function completion/git::bisect:terms:arg {
OPTIONS=( #>#
"--term-old --term-good; only show the term for the old state"
"--term-new --term-bad; only show the term for the new state"
) #<#
command -f completion//parseoptions
case $ARGOPT in
(-)
command -f completion//completeoptions
;;
(--term-*)
;;
esac
}
#function completion/git::bisect:view:arg {
#}
#function completion/git::bisect:visualize:arg {
#}
# vim: set ft=sh ts=8 sts=8 sw=8 et:
|