copliot extension
This commit is contained in:
@@ -37,6 +37,7 @@ in {
|
|||||||
ghostty
|
ghostty
|
||||||
nixgl.nixGLIntel
|
nixgl.nixGLIntel
|
||||||
(config.lib.nixGL.wrap ghostty)
|
(config.lib.nixGL.wrap ghostty)
|
||||||
|
wl-clipboard
|
||||||
];
|
];
|
||||||
|
|
||||||
programs.ghostty = {
|
programs.ghostty = {
|
||||||
@@ -74,6 +75,83 @@ export DOTNET_ROOT=${pkgs.dotnetCorePackages.sdk_8_0}
|
|||||||
|
|
||||||
set -x LIBVIRT_DEFAULT_URI qemu:///system
|
set -x LIBVIRT_DEFAULT_URI qemu:///system
|
||||||
set -x TERM xterm-256color # ghostty
|
set -x TERM xterm-256color # ghostty
|
||||||
|
|
||||||
|
# https://github.com/DevAtDawn/gh-fish/blob/main/gh-copilot-alias.fish
|
||||||
|
function ghcs
|
||||||
|
set -l FUNCNAME (status function)
|
||||||
|
set -l TARGET "shell"
|
||||||
|
set -l GH_DEBUG "$GH_DEBUG"
|
||||||
|
set -l GH_HOST "$GH_HOST"
|
||||||
|
set -l __USAGE "
|
||||||
|
Wrapper around \`gh copilot suggest\` to suggest a command based on a natural language description of the desired output effort.
|
||||||
|
Supports executing suggested commands if applicable.
|
||||||
|
USAGE
|
||||||
|
$FUNCNAME [flags] <prompt>
|
||||||
|
FLAGS
|
||||||
|
-d, --debug Enable debugging
|
||||||
|
-h, --help Display help usage
|
||||||
|
--hostname The GitHub host to use for authentication
|
||||||
|
-t, --target target Target for suggestion; must be shell, gh, git
|
||||||
|
default: \"$TARGET\"
|
||||||
|
EXAMPLES
|
||||||
|
- Guided experience
|
||||||
|
$FUNCNAME
|
||||||
|
- Git use cases
|
||||||
|
$FUNCNAME -t git \"Undo the most recent local commits\"
|
||||||
|
$FUNCNAME -t git \"Clean up local branches\"
|
||||||
|
$FUNCNAME -t git \"Setup LFS for images\"
|
||||||
|
- Working with the GitHub CLI in the terminal
|
||||||
|
$FUNCNAME -t gh \"Create pull request\"
|
||||||
|
$FUNCNAME -t gh \"List pull requests waiting for my review\"
|
||||||
|
$FUNCNAME -t gh \"Summarize work I have done in issues and pull requests for promotion\"
|
||||||
|
- General use cases
|
||||||
|
$FUNCNAME \"Kill processes holding onto deleted files\"
|
||||||
|
$FUNCNAME \"Test whether there are SSL/TLS issues with github.com\"
|
||||||
|
$FUNCNAME \"Convert SVG to PNG and resize\"
|
||||||
|
$FUNCNAME \"Convert MOV to animated PNG\"
|
||||||
|
"
|
||||||
|
|
||||||
|
set -l argv_copy $argv
|
||||||
|
for i in (seq (count $argv_copy))
|
||||||
|
switch $argv_copy[$i]
|
||||||
|
case '-d' '--debug'
|
||||||
|
set -l GH_DEBUG "api"
|
||||||
|
case '-h' '--help'
|
||||||
|
echo "$__USAGE"
|
||||||
|
return 0
|
||||||
|
case '--hostname'
|
||||||
|
set -l GH_HOST $argv_copy[(math $i + 1)]
|
||||||
|
set -e argv_copy[(math $i + 1)]
|
||||||
|
case '-t' '--target'
|
||||||
|
set -l TARGET $argv_copy[(math $i + 1)]
|
||||||
|
set -e argv_copy[(math $i + 1)]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
set -e argv_copy[1..(math $i - 1)]
|
||||||
|
|
||||||
|
set -l TMPFILE (mktemp -t gh-copilotXXXXXX)
|
||||||
|
function cleanup
|
||||||
|
rm -f "$TMPFILE"
|
||||||
|
end
|
||||||
|
trap cleanup EXIT
|
||||||
|
|
||||||
|
if env GH_DEBUG="$GH_DEBUG" GH_HOST="$GH_HOST" gh copilot suggest -t "$TARGET" $argv_copy --shell-out "$TMPFILE"
|
||||||
|
if test -s "$TMPFILE"
|
||||||
|
set -l FIXED_CMD (cat $TMPFILE)
|
||||||
|
history --merge --save -- $FIXED_CMD
|
||||||
|
echo
|
||||||
|
eval $FIXED_CMD
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function plz
|
||||||
|
ghcs suggest "$argv"
|
||||||
|
end
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
home.file = {
|
home.file = {
|
||||||
|
|||||||
Reference in New Issue
Block a user