perf: remove unnecessary subshells in command -v checks

Replace 'if (command -v x &>/dev/null); then' with
'if command -v x &>/dev/null; then' across completion.d, rc.d and
profile.d. Parentheses forced a subshell fork for every 'if' check,
which is unnecessary overhead since command -v runs fine in the
current shell.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Xavier LogeraisandCopilot committed 2026-09-28 18:17:13 +02:00
1 parent 6d791dbe29
commit 158c3f99f0
30 files changed
+36 -36

No files matched your search

+3 -3
View File
@@ -5,7 +5,7 @@
MY_HISTORY_TOOLS="atuin mcfly"
for tool in ${MY_HISTORY_TOOLS}; do
if (command -v "${tool}" &>/dev/null); then
if command -v "${tool}" &>/dev/null; then
USE_HISTORY_TOOL="${tool}"
break
fi
@@ -15,7 +15,7 @@ case "${USE_HISTORY_TOOL}" in
# https://atuin.sh/
"atuin")
if (command -v atuin &>/dev/null); then
if command -v atuin &>/dev/null; then
eval "$(atuin init bash)"
else
echo "${USE_HISTORY_TOOL} command not found"
@@ -24,7 +24,7 @@ case "${USE_HISTORY_TOOL}" in
# https://github.com/cantino/mcfly
"mcfly")
if (command -v mcfly &>/dev/null); then
if command -v mcfly &>/dev/null; then
export MCFLY_PROMPT="❯ "
export MCFLY_INTERFACE_VIEW=BOTTOM
export MCFLY_RESULTS=50