Removing dispatch function

This commit is contained in:
Chris Apple 2024-02-06 06:30:33 -08:00
parent b6aa5c4dc8
commit 7c3c28f409

View file

@ -114,101 +114,9 @@ compdef _git-staged forgit::reset::head
compdef __git_recent_commits forgit::revert::commit
compdef _git-stash-show forgit::stash::show
_forgit-dispatch() {
subcommand="${words[1]}"
if [[ $subcommand == "forgit::add" ]]; then
_git-add
return
fi
if [[ $subcommand == "forgit::branch::delete" ]]; then
_git-branches
return
fi
if [[ $subcommand == "forgit::checkout::branch" ]]; then
_git-branches
return
fi
if [[ $subcommand == "forgit::checkout::commit" ]]; then
__git_recent_commits
return
fi
if [[ $subcommand == "forgit::checkout::file" ]]; then
_git-checkout-file
return
fi
if [[ $subcommand == "forgit::checkout::tag" ]]; then
__git_tags
return
fi
if [[ $subcommand == "forgit::cherry::pick" ]]; then
_git-cherry-pick
return
fi
if [[ $subcommand == "forgit::cherry::pick::from::branch" ]]; then
_git-branches
return
fi
if [[ $subcommand == "forgit::clean" ]]; then
_git-clean
return
fi
if [[ $subcommand == "forgit::diff" ]]; then
_git-forgit-diff
return
fi
if [[ $subcommand == "forgit::fixup" ]]; then
__git_branch_names
return
fi
if [[ $subcommand == "forgit::log" ]]; then
_git-log
return
fi
if [[ $subcommand == "forgit::rebase" ]]; then
_git-rebase
return
fi
if [[ $subcommand == "forgit::reset::head" ]]; then
_git-staged
return
fi
if [[ $subcommand == "forgit::revert::commit" ]]; then
__git_recent_commits
return
fi
if [[ $subcommand == "forgit::stash::show" ]]; then
_git-stash-show
return
fi
# this is the case of calling "git forgit"
if [[ $subcommand == "forgit" ]]; then
_git-forgit
return
fi
return 1
}
# this is the case of calling the command and pressing tab
# the very first time of a shell session, we have to manually
# call the dispatch function
if [[ $funcstack[1] == "_git-forgit" ]]; then
_forgit-dispatch "$@"
_git-forgit "$@"
fi