Skip to content

Commit 15cedf1

Browse files
committed
feat: Add support for fish shell in instructions
Add fish shell support in gitsign credential cache setup instructions. Signed-off-by: Ananth Bhaskararaman <[email protected]>
1 parent 512c386 commit 15cedf1

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

cmd/gitsign-credential-cache/README.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -192,18 +192,29 @@ if [ -f "${HOME}/.zshrc" ]; then
192192
shell_config_file="${HOME}/.zshrc"
193193
elif [ -f "${HOME}/.bashrc" ]; then
194194
shell_config_file="${HOME}/.bashrc"
195+
elif [ -f "${HOME}/.config/fish/config.fish" ]; then
196+
if [ ! -f "${HOME}/.config/fish/conf.d/gitsign-credential-cache.fish" ]; then
197+
echo "set -x GITSIGN_CREDENTIAL_CACHE \"${gitsign_cache_path}\"" > "${HOME}/.config/fish/conf.d/gitsign-credential-cache.fish"
198+
echo "Added GITSIGN_CREDENTIAL_CACHE to ${HOME}/.config/fish/conf.d/gitsign-credential-cache.fish. Please restart your shell to apply the changes."
199+
else
200+
echo "GITSIGN_CREDENTIAL_CACHE already exists in ${HOME}/.config/fish/conf.d/gitsign-credential-cache.fish!"
201+
fi
202+
shell_config_file=""
195203
else
196204
echo "No .bashrc or .zshrc found in your home directory."
197205
exit 1
198206
fi
199207

200-
export_line="export GITSIGN_CREDENTIAL_CACHE=\"${gitsign_cache_path}\""
201-
if ! grep -qF -- "${export_line}" "${shell_config_file}"; then
202-
echo "${export_line}" >> "${shell_config_file}"
203-
echo "Added GITSIGN_CREDENTIAL_CACHE to ${shell_config_file}. Please restart your shell to apply the changes: 'source ${shell_config_file}'"
204-
else
205-
echo "GITSIGN_CREDENTIAL_CACHE already exists in ${shell_config_file}!"
208+
if [ ! -z "${shell_config_file}" ]; then
209+
export_line="export GITSIGN_CREDENTIAL_CACHE=\"${gitsign_cache_path}\""
210+
if ! grep -qF -- "${export_line}" "${shell_config_file}"; then
211+
echo "${export_line}" >> "${shell_config_file}"
212+
echo "Added GITSIGN_CREDENTIAL_CACHE to ${shell_config_file}. Please restart your shell to apply the changes: 'source ${shell_config_file}'"
213+
else
214+
echo "GITSIGN_CREDENTIAL_CACHE already exists in ${shell_config_file}!"
215+
fi
206216
fi
217+
207218
EOF
208219
chmod +x /tmp/gitsign-credential-cache.sh
209220
echo "Running the script to create the launchctl service..."
@@ -221,4 +232,4 @@ and of course if you would like to tail the logs of your service you can do so b
221232

222233
```sh
223234
tail -f /opt/homebrew/var/log/gitsign-credential-cache.log
224-
```
235+
```

0 commit comments

Comments
 (0)