Last active
July 22, 2025 16:21
-
-
Save kevincolten/9cf524f5022f0d5aa838a0bcb85274b5 to your computer and use it in GitHub Desktop.
GH Copilot on zsh command line
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ghc() { | |
local output=$(printf '\n\n' | gh copilot suggest -t shell "$*" 2>&1) | |
local suggested_command=$(echo "$output" | awk '/# Suggestion:/{getline; getline; gsub(/^[ \t]+/, ""); gsub(/[ \t]+$/, ""); if(NF>0) {printf "%s", $0; exit}}') | |
[ -n "$suggested_command" ] && print -z "$suggested_command" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
example: