mirror of
https://github.com/Xevion/dotfiles.git
synced 2026-01-31 00:24:06 -06:00
feat: add Fish function wrappers for copilot suggest/explain commands
Replace gh copilot aliases with custom Fish functions that provide better help text and wrap the copilot CLI with appropriate prompts
This commit is contained in:
@@ -949,8 +949,8 @@ alias romanlog = ssh roman 'tail -F /var/log/syslog' --lines 100
|
||||
|
||||
# Other aliases
|
||||
alias gpt = chatgpt
|
||||
alias copilot = gh copilot
|
||||
alias suggest = gh copilot suggest -t shell
|
||||
alias copilot = copilot
|
||||
alias suggest = copilot -p "suggest:" --allow-all-tools
|
||||
alias spt = spotify_player
|
||||
{{ if eq .chezmoi.os "linux" }}
|
||||
alias mousefix = sudo udevadm trigger
|
||||
|
||||
@@ -48,8 +48,7 @@ abbr -a copeh 'claude --model haiku'
|
||||
abbr -a hcope 'claude --model haiku'
|
||||
abbr -a gpt 'chatgpt'
|
||||
abbr -a share 'share.ts'
|
||||
abbr -a copilot 'gh copilot'
|
||||
abbr -a suggest 'gh copilot suggest -t shell'
|
||||
abbr -a copilot 'copilot'
|
||||
abbr -a spt 'spotify_player'
|
||||
abbr -a gitalias 'alias | grep "git "'
|
||||
abbr -a mousefix 'sudo udevadm trigger'
|
||||
|
||||
@@ -23,7 +23,7 @@ function chai --description "Interactive chezmoi apply with fzf diff preview"
|
||||
--with-nth=4 \
|
||||
--nth=1 \
|
||||
--prompt='Apply Changes > ' \
|
||||
--preview='chezmoi diff {1} 2>/dev/null | bat -pp --color=always --language=diff' \
|
||||
--preview='chezmoi diff ~/{1} 2>/dev/null | bat -pp --color=always --language=diff' \
|
||||
--preview-window=right:60%:wrap \
|
||||
--multi \
|
||||
--bind='ctrl-a:toggle-all' \
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
function explain --description "Explain a command using GitHub Copilot"
|
||||
argparse --name=explain \
|
||||
'd/debug' \
|
||||
'h/help' \
|
||||
'hostname=' \
|
||||
-- $argv
|
||||
or return 1
|
||||
|
||||
if set -q _flag_help
|
||||
echo "Wrapper around \`copilot\` to explain a command."
|
||||
echo
|
||||
echo "USAGE"
|
||||
echo " explain [flags] <command>"
|
||||
echo
|
||||
echo "FLAGS"
|
||||
echo " -d, --debug Enable debugging"
|
||||
echo " -h, --help Display help usage"
|
||||
echo " --hostname HOST GitHub host for authentication"
|
||||
echo
|
||||
echo "EXAMPLES"
|
||||
echo " explain 'du -sh | sort -h'"
|
||||
echo " explain 'git log --oneline --graph --decorate --all'"
|
||||
echo " explain 'bfg --strip-blobs-bigger-than 50M'"
|
||||
return 0
|
||||
end
|
||||
|
||||
copilot -p "explain: $argv" --allow-all-tools
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
function ghce --wraps explain --description "Alias for explain (GitHub Copilot)"
|
||||
explain $argv
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
function ghcs --wraps suggest --description "Alias for suggest (GitHub Copilot)"
|
||||
suggest $argv
|
||||
end
|
||||
@@ -0,0 +1,32 @@
|
||||
function suggest --description "Suggest a command using GitHub Copilot"
|
||||
argparse --name=suggest \
|
||||
'd/debug' \
|
||||
'h/help' \
|
||||
'hostname=' \
|
||||
't/target=' \
|
||||
-- $argv
|
||||
or return 1
|
||||
|
||||
if set -q _flag_help
|
||||
echo "Wrapper around \`copilot\` to suggest a command."
|
||||
echo "Places suggested command on the command line for review/editing."
|
||||
echo
|
||||
echo "USAGE"
|
||||
echo " suggest [flags] <prompt>"
|
||||
echo
|
||||
echo "FLAGS"
|
||||
echo " -d, --debug Enable debugging"
|
||||
echo " -h, --help Display help usage"
|
||||
echo " --hostname HOST GitHub host for authentication"
|
||||
echo " -t, --target TARGET Target: shell (default), gh, git"
|
||||
echo
|
||||
echo "EXAMPLES"
|
||||
echo " suggest"
|
||||
echo " suggest -t git 'Undo the most recent local commits'"
|
||||
echo " suggest -t gh 'Create pull request'"
|
||||
echo " suggest 'Convert MOV to animated PNG'"
|
||||
return 0
|
||||
end
|
||||
|
||||
copilot -p "suggest: $argv" --allow-all-tools
|
||||
end
|
||||
@@ -44,8 +44,8 @@ alias copes='claude --model sonnet'
|
||||
alias copeh='claude --model haiku'
|
||||
alias hcope='claude --model haiku'
|
||||
alias gpt='chatgpt'
|
||||
alias copilot='gh copilot'
|
||||
alias suggest='gh copilot suggest -t shell'
|
||||
alias copilot='copilot'
|
||||
alias suggest='copilot -p "suggest:" --allow-all-tools'
|
||||
alias spt='spotify_player'
|
||||
alias gitalias='alias | grep "git "'
|
||||
alias mousefix='sudo udevadm trigger' # helped with mouse issues on laptop
|
||||
|
||||
Reference in New Issue
Block a user