Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add support for fish shell in instructions #560

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions cmd/gitsign-credential-cache/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,18 +192,29 @@ if [ -f "${HOME}/.zshrc" ]; then
shell_config_file="${HOME}/.zshrc"
elif [ -f "${HOME}/.bashrc" ]; then
shell_config_file="${HOME}/.bashrc"
elif [ -f "${HOME}/.config/fish/config.fish" ]; then
if [ ! -f "${HOME}/.config/fish/conf.d/gitsign-credential-cache.fish" ]; then
echo "set -x GITSIGN_CREDENTIAL_CACHE \"${gitsign_cache_path}\"" > "${HOME}/.config/fish/conf.d/gitsign-credential-cache.fish"
echo "Added GITSIGN_CREDENTIAL_CACHE to ${HOME}/.config/fish/conf.d/gitsign-credential-cache.fish. Please restart your shell to apply the changes."
else
echo "GITSIGN_CREDENTIAL_CACHE already exists in ${HOME}/.config/fish/conf.d/gitsign-credential-cache.fish!"
fi
shell_config_file=""
else
echo "No .bashrc or .zshrc found in your home directory."
exit 1
fi

export_line="export GITSIGN_CREDENTIAL_CACHE=\"${gitsign_cache_path}\""
if ! grep -qF -- "${export_line}" "${shell_config_file}"; then
echo "${export_line}" >> "${shell_config_file}"
echo "Added GITSIGN_CREDENTIAL_CACHE to ${shell_config_file}. Please restart your shell to apply the changes: 'source ${shell_config_file}'"
else
echo "GITSIGN_CREDENTIAL_CACHE already exists in ${shell_config_file}!"
if [ ! -z "${shell_config_file}" ]; then
export_line="export GITSIGN_CREDENTIAL_CACHE=\"${gitsign_cache_path}\""
if ! grep -qF -- "${export_line}" "${shell_config_file}"; then
echo "${export_line}" >> "${shell_config_file}"
echo "Added GITSIGN_CREDENTIAL_CACHE to ${shell_config_file}. Please restart your shell to apply the changes: 'source ${shell_config_file}'"
else
echo "GITSIGN_CREDENTIAL_CACHE already exists in ${shell_config_file}!"
fi
fi

EOF
chmod +x /tmp/gitsign-credential-cache.sh
echo "Running the script to create the launchctl service..."
Expand All @@ -221,4 +232,4 @@ and of course if you would like to tail the logs of your service you can do so b

```sh
tail -f /opt/homebrew/var/log/gitsign-credential-cache.log
```
```