2
0
mirror of https://github.com/kazhala/dotbare synced 2024-11-02 09:40:27 +00:00

feat(completion): update fgrep related completion

This commit is contained in:
Kevin Zhuang 2020-08-03 22:58:34 +10:00
parent efbd93eb1e
commit cc769f9968
2 changed files with 10 additions and 2 deletions

View File

@ -94,10 +94,10 @@ __dotbare_completion()
return
fi
elif [[ "${COMP_WORDS[1]}" == "fbackup" && "${prev}" == "-p" ]]; then
elif [[ "${COMP_WORDS[1]}" == "fbackup" ]] && [[ "${prev}" == "-p" || "${prev}" == "--path" ]]; then
COMPREPLY=($(compgen -d -- "${curr}"))
return
elif [[ "${COMP_WORDS[1]}" == "finit" && "${prev}" == "-u" ]]; then
elif [[ "${COMP_WORDS[1]}" == "finit" ]] && [[ "${prev}" == "-u" || "${prev}" == "--url" ]]; then
return
elif [[ "${curr}" == --* && "${prev}" != "-h" && "${prev}" != "--help" ]]; then
verbose_options=$(
@ -107,6 +107,8 @@ __dotbare_completion()
print "--path"
} else if ($0 ~ /^ -u URL/) {
print "--url"
} else if ($0 ~ /^ -c COL/) {
print "--col"
} else if ($0 ~ /^ -*/) {
print $2
}
@ -126,6 +128,10 @@ __dotbare_completion()
gsub(/^ -u URL --url URL/, "-u", $0)
gsub(/\t/, " ", $0)
print $0
} else if ($0 ~ /^ -c COL/) {
gsub(/^ -c COL --col COL/, "-c", $0)
gsub(/\t/, " ", $0)
print $0
} else if ($0 ~ /^ -*/) {
gsub(/^ /, "", $0)
gsub(/\t/, " ", $0)

View File

@ -75,6 +75,8 @@ __dotbare_completion() {
fgrep)
_arguments \
'(- : *)'{-h,--help}'[show help information]' \
'(-f --full -c --col)'{-f,--full}'[include all columns during fzf search, as if using "--col 1"]' \
'(-f --full -c --col)'{-c,--col}'[specify a column number to start searching in fzf]: :->cols' \
&& ret=0
;;
finit)