Add copilot completions

This commit is contained in:
Tony Blyler 2022-06-20 19:51:21 -04:00
parent 92266cddcb
commit dbba851509
Signed by: tblyler
GPG key ID: 7F13D9A60C0D678E

View file

@ -0,0 +1,23 @@
#!/usr/bin/zsh
(
set -euo pipefail
if ! command -v copilot &> /dev/null; then
exit 0
fi
COPILOT_COMPLETION_PATH="${ZSH_COMPLETIONS_DIR}/_copilot"
if [ -r "$COPILOT_COMPLETION_PATH" ]; then
zstat -H COMPLETION_FILE_STAT "$COPILOT_COMPLETION_PATH"
zstat -H COPILOT_FILE_STAT "$(command -v copilot)"
if [ "${COMPLETION_FILE_STAT[ctime]}" -ge "${COPILOT_FILE_STAT[ctime]}" ]; then
exit 0
fi
fi
copilot completion zsh > "$COPILOT_COMPLETION_PATH"
chmod +x "$COPILOT_COMPLETION_PATH"
)