From 50b21937b3fd0ab6ff93662ac2d0062e9a1e6bae Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Fri, 21 Apr 2023 15:00:37 +0100 Subject: [PATCH] feat(shell): setup for GitHub Copilot CLI --- zsh/copilot.zsh | 31 +++++++++++++++++++++++++++++++ zsh/nodejs.zsh | 1 + zshrc | 1 + 3 files changed, 33 insertions(+) create mode 100644 zsh/copilot.zsh diff --git a/zsh/copilot.zsh b/zsh/copilot.zsh new file mode 100644 index 0000000..7a66085 --- /dev/null +++ b/zsh/copilot.zsh @@ -0,0 +1,31 @@ +# +# Setup for GitHub Copilot CLI +# + +# Lazy-load the Copilot CLI helpers on first use. +if command-exists github-copilot-cli; then + setup_copilot-cli-integration() { + local cmd="$1" + shift + + eval "$(github-copilot-cli alias -- "$SHELL")" + + "$cmd" "$@" + } + + copilot_what-the-shell() { + setup_copilot-cli-integration "$0" "$@" + } + alias '??'='copilot_what-the-shell' + alias 'wts'='copilot_what-the-shell' + + copilot_git-assist() { + setup_copilot-cli-integration "$0" "$@" + } + alias 'git?'='copilot_git-assist' + + copilot_gh-assist() { + setup_copilot-cli-integration "$0" "$@" + } + alias 'gh?'='copilot_gh-assist' +fi diff --git a/zsh/nodejs.zsh b/zsh/nodejs.zsh index a5768d7..3523a87 100755 --- a/zsh/nodejs.zsh +++ b/zsh/nodejs.zsh @@ -10,6 +10,7 @@ install_node_global_packages() { local npm_packages=( @commitlint/cli @commitlint/config-conventional + @githubnext/github-copilot-cli @mermaid-js/mermaid-cli @prettier/plugin-php @prettier/plugin-ruby diff --git a/zshrc b/zshrc index 3ec49c8..5c76507 100644 --- a/zshrc +++ b/zshrc @@ -126,6 +126,7 @@ if [[ "$OSTYPE" == "linux"* ]]; then source "$DOTZSH/linux.zsh"; fi # Utils source "$DOTZSH/1password.zsh" +source "$DOTZSH/copilot.zsh" source "$DOTZSH/emacs.zsh" source "$DOTZSH/fzf.zsh" source "$DOTZSH/less.zsh"