117 字
1 分钟
Using GitHub Copilot in the Terminal with pwsh

If you could use GitHub Copilot in the terminal, it would be much more convenient—many commands wouldn’t need to be memorized deliberately, and you wouldn’t need to search online for a long time.

First, download Github-CLI. Then log in with gh auth login. Copilot is not installed by default; you need to manually install the extension with gh extension install github/gh-copilot.

Test whether gh copilot works properly.

Then set up aliases for convenience. Read the path of the config file with echo $PROFILE, then modify it with notepad $PROFILE. Add the following content.

Terminal window
function Github-Copilot-Explain { gh copilot explain $args }
function Github-Copilot-Suggest { gh copilot suggest $args }
Set-Alias -Name cs -Value Github-Copilot-Suggest
Set-Alias -Name ce -Value Github-Copilot-Explain
Using GitHub Copilot in the Terminal with pwsh
https://tski.uk/blog/en/github-copilot/
作者
Tokisaki Galaxy
发布于
2023-12-20
许可协议
CC BY