Skip to content

Commit

Permalink
[bash] Don’t print function definition when checking for existence (#…
Browse files Browse the repository at this point in the history
…3448)

When just checking whether a function is already defined or not, it’s not
necessary to print out it’s definition (should it be defined).

bash’s `declare` provides the `-F`-option (which implies `-f`), which should
give a minor performance improvement

Signed-off-by: Christoph Anton Mitterer <[email protected]>
  • Loading branch information
calestyo authored Oct 2, 2023
1 parent ee4ba10 commit e833823
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions shell/completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
if [[ $- =~ i ]]; then

# To use custom commands instead of find, override _fzf_compgen_{path,dir}
if ! declare -f _fzf_compgen_path > /dev/null; then
if ! declare -F _fzf_compgen_path > /dev/null; then
_fzf_compgen_path() {
echo "$1"
command find -L "$1" \
Expand All @@ -21,7 +21,7 @@ if ! declare -f _fzf_compgen_path > /dev/null; then
}
fi

if ! declare -f _fzf_compgen_dir > /dev/null; then
if ! declare -F _fzf_compgen_dir > /dev/null; then
_fzf_compgen_dir() {
command find -L "$1" \
-name .git -prune -o -name .hg -prune -o -name .svn -prune -o -type d \
Expand Down

0 comments on commit e833823

Please sign in to comment.