Skip to content

Commit

Permalink
source bash-completion if it exists
Browse files Browse the repository at this point in the history
  • Loading branch information
joshi4 committed Oct 24, 2024
1 parent 9eec3dc commit 58af095
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion cmd/setup/bash.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,22 @@ if ! source_file "$BASH_HOOKS_CONTENT"; then
return 1
fi
source <(savvy completion bash)
# Detect the operating system and source bash completion
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
if command -v brew >/dev/null 2>&1; then
if [[ -f "$(brew --prefix)/etc/bash_completion" ]]; then
source "$(brew --prefix)/etc/bash_completion"
source <(savvy completion bash)
fi
fi
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
# Linux
if [[ -f "/etc/bash_completion" ]]; then
source "/etc/bash_completion"
source <(savvy completion bash)
fi
fi
`

// initCmd represents the init command
Expand Down

0 comments on commit 58af095

Please sign in to comment.