From bf6636c14b7fdca1cedddcfbaaa985fd363493ff Mon Sep 17 00:00:00 2001 From: Kid <44045911+kidonng@users.noreply.github.com> Date: Tue, 6 Jul 2021 16:49:55 +0800 Subject: [PATCH] Remove unnecessary `basename` and `awk` call (#15) * Remove unnecessary basename and awk call * Replace `exit` with `return` --- conf.d/fish_apple_touchbar.fish | 12 +++--------- functions/fish-apple-touchbar.fish | 2 +- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/conf.d/fish_apple_touchbar.fish b/conf.d/fish_apple_touchbar.fish index 4c07e70..0c73997 100644 --- a/conf.d/fish_apple_touchbar.fish +++ b/conf.d/fish_apple_touchbar.fish @@ -2,17 +2,11 @@ # Source: https://github.com/jorgebucaran/fisher/issues/651#issuecomment-762808325 fish-apple-touchbar -# Expected value should be fish_apple_touchbar_install -set --local plugin_name_install (basename (status --current-filename) .fish)_install - -# Expected value should be fish_apple_touchbar_uninstall -set --local plugin_name_uninstall (basename (status --current-filename) .fish)_uninstall - -function __fish_apple_touchbar_install --on-event "$plugin_name_install" +function __fish_apple_touchbar_install --on-event "fish_apple_touchbar_install" __fish_apple_touchbar_first_view end -function __fish_apple_touchbar_uninstall --on-event "$plugin_name_uninstall" +function __fish_apple_touchbar_uninstall --on-event "fish_apple_touchbar_uninstall" __fish_apple_touchbar_reset_bindings - functions --erase (functions --all | command awk '/^__fish_apple_touchbar/') + functions --erase (functions --all | string match --regex --entire '^__fish_apple_touchbar') end diff --git a/functions/fish-apple-touchbar.fish b/functions/fish-apple-touchbar.fish index 94892a2..2cfd963 100644 --- a/functions/fish-apple-touchbar.fish +++ b/functions/fish-apple-touchbar.fish @@ -1,6 +1,6 @@ function fish-apple-touchbar if not status is-interactive - exit 0 + return 0 end function __fish_apple_touchbar_first_view function _bind_keys_function_1