From: Oleg Broytman Date: Mon, 20 Jul 2020 07:46:05 +0000 (+0300) Subject: Refactor(.shellrc): Return early from `delegate_completion` X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=fb77946f36e1fa4cfaeb4a5af00f45e28dca73af;p=dotfiles.git Refactor(.shellrc): Return early from `delegate_completion` Save one indent level. --- diff --git a/.shellrc b/.shellrc index a75cae9..70393ad 100644 --- a/.shellrc +++ b/.shellrc @@ -130,17 +130,16 @@ if test -n "$BASH_VERSION"; then delegate_completion() { local prog programs prog=$1 - if has_completion $prog; then - shift - programs="$@" - eval "_${prog}_completion_loader() { - _completion_loader $prog - complete -o nospace -F _$prog $programs - unset _${prog}_completion_loader - return 124 - }" - complete -F _${prog}_completion_loader $programs - fi + ! has_completion $prog && return + shift + programs="$@" + eval "_${prog}_completion_loader() { + _completion_loader $prog + complete -o nospace -F _$prog $programs + unset _${prog}_completion_loader + return 124 + }" + complete -F _${prog}_completion_loader $programs } delegate_completion make m