mirror of
https://github.com/kogakure/dotfiles.git
synced 2026-02-03 20:25:30 +00:00
feat(fish): add GitHub Copilot CLI
This commit is contained in:
@@ -156,7 +156,7 @@ if type nvim >/dev/null 2>&1
|
||||
end
|
||||
|
||||
# TMUX
|
||||
alias tx tmux
|
||||
alias t tmux
|
||||
alias mux tmuxinator
|
||||
alias ms 'mux start'
|
||||
alias ta 'tmux attach'
|
||||
@@ -176,5 +176,11 @@ alias icloud "cd ~/Library/Mobile\ Documents/com~apple~CloudDocs"
|
||||
# Clear the screen
|
||||
alias c clear
|
||||
|
||||
# GitHub Copilot CLI
|
||||
alias cpw copilot_what-the-shell
|
||||
alias cpg copilot_git-assist
|
||||
alias cpgh copilot_github-assist
|
||||
alias wts copilot_what-the-shell
|
||||
|
||||
# Prompt
|
||||
starship init fish | source
|
||||
|
||||
15
fish/functions/copilot_gh-assist.fish
Normal file
15
fish/functions/copilot_gh-assist.fish
Normal file
@@ -0,0 +1,15 @@
|
||||
function copilot_gh-assist
|
||||
set TMPFILE (mktemp)
|
||||
trap 'rm -f $TMPFILE' EXIT
|
||||
if github-copilot-cli gh-assist $argv --shellout $TMPFILE
|
||||
if test -e "$TMPFILE"
|
||||
set FIXED_CMD (cat $TMPFILE)
|
||||
echo -s "$FIXED_CMD"
|
||||
eval "$FIXED_CMD"
|
||||
else
|
||||
echo "Apologies! Extracting command failed"
|
||||
end
|
||||
else
|
||||
return 1
|
||||
end
|
||||
end
|
||||
15
fish/functions/copilot_git-assist.fish
Normal file
15
fish/functions/copilot_git-assist.fish
Normal file
@@ -0,0 +1,15 @@
|
||||
function copilot_git-assist
|
||||
set TMPFILE (mktemp)
|
||||
trap 'rm -f $TMPFILE' EXIT
|
||||
if github-copilot-cli git-assist $argv --shellout $TMPFILE
|
||||
if test -e "$TMPFILE"
|
||||
set FIXED_CMD (cat $TMPFILE)
|
||||
echo -s "$FIXED_CMD"
|
||||
eval "$FIXED_CMD"
|
||||
else
|
||||
echo "Apologies! Extracting command failed"
|
||||
end
|
||||
else
|
||||
return 1
|
||||
end
|
||||
end
|
||||
15
fish/functions/copilot_what-the-shell.fish
Normal file
15
fish/functions/copilot_what-the-shell.fish
Normal file
@@ -0,0 +1,15 @@
|
||||
function copilot_what-the-shell
|
||||
set TMPFILE (mktemp)
|
||||
trap 'rm -f $TMPFILE' EXIT
|
||||
if github-copilot-cli what-the-shell $argv --shellout $TMPFILE
|
||||
if test -e "$TMPFILE"
|
||||
set FIXED_CMD (cat $TMPFILE)
|
||||
echo -s "$FIXED_CMD"
|
||||
eval "$FIXED_CMD"
|
||||
else
|
||||
echo "Apologies! Extracting command failed"
|
||||
end
|
||||
else
|
||||
return 1
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user