-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable git autocomplete in the devcontainer
- Loading branch information
1 parent
a364dcf
commit 1f15bd9
Showing
3 changed files
with
22 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "Git Autocomplete", | ||
"id": "git-autocomplete", | ||
"version": "1.0.0", | ||
"description": "Enable git autocomplete in the shell", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env bash | ||
UPDATE_RC="${UPDATE_RC:-"true"}" | ||
AUTOCOMPLETE_SOURCE="source /usr/share/bash-completion/completions/git" | ||
|
||
if [ "${UPDATE_RC}" = "true" ]; then | ||
echo "Updating /etc/bash.bashrc and /etc/zsh/zshrc..." | ||
if [[ "$(cat /etc/bash.bashrc)" != *"${AUTOCOMPLETE_SOURCE}"* ]]; then | ||
echo -e "${AUTOCOMPLETE_SOURCE}" >> /etc/bash.bashrc | ||
fi | ||
if [ -f "/etc/zsh/zshrc" ] && [[ "$(cat /etc/zsh/zshrc)" != *"${AUTOCOMPLETE_SOURCE}"* ]]; then | ||
echo -e "${AUTOCOMPLETE_SOURCE}" >> /etc/zsh/zshrc | ||
fi | ||
fi |