Add copilot completions
This commit is contained in:
parent
92266cddcb
commit
dbba851509
1 changed files with 23 additions and 0 deletions
23
chezmoi/dot_zshrc.d/executable_copilot.zsh
Normal file
23
chezmoi/dot_zshrc.d/executable_copilot.zsh
Normal 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"
|
||||||
|
)
|
Loading…
Reference in a new issue