]> git.phdru.name Git - dotfiles.git/commitdiff
Refactor(.shellrc): Return early from `delegate_completion`
authorOleg Broytman <phd@phdru.name>
Mon, 20 Jul 2020 07:46:05 +0000 (10:46 +0300)
committerOleg Broytman <phd@phdru.name>
Mon, 20 Jul 2020 07:46:05 +0000 (10:46 +0300)
Save one indent level.

.shellrc

index a75cae9936255d4771851178e605c6d3ddfdbac5..70393ad7d51d3cc77db6f10d5a66d4590bea5897 100644 (file)
--- 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