gh-copilot icon indicating copy to clipboard operation
gh-copilot copied to clipboard

[FEAT]: For `gh copilot suggest`, add a flag to send only the suggested command to stdout

Open howlowck opened this issue 11 months ago • 7 comments

Describe the need

I would like a way for the copilot cli suggest command to send only the suggested command to stdout, and then terminate the process, instead of being asked to copy the command to the clipboard.

Eliminating the user interaction and sending the suggestion to stdout would also make it more programmable.

Version

Do these docs apply to a specific version? currently using version 0.5.4-beta (2024-01-04), but should apply to all versions

Relevant terminal output

Instead of...

❯ gh copilot suggest -t shell "get pokemon id 3 information from pokemon api and pipe it to jq to get the name"

Welcome to GitHub Copilot in the CLI!
version 0.5.4-beta (2024-01-04)

I'm powered by AI, so surprises and mistakes are possible. Make sure to verify any generated code or suggestions, and share feedback so that we can learn and improve. For more information, see https://gh.io/gh-copilot-transparency

Suggestion:

  curl -s "https://pokeapi.co/api/v2/pokemon/3" | jq '.name'

? Select an option
> Copy command to clipboard

Command copied to clipboard!

? Select an option  [Use arrows to move, type to filter]
> Copy command to clipboard
  Explain command
  Revise command
  Rate response
  Exit

It would just be...

❯ gh copilot suggest -t shell --non-interactive "get pokemon id 3 information from pokemon api and pipe it to jq to get the name"

curl -s "https://pokeapi.co/api/v2/pokemon/3" | jq '.name'

howlowck avatar Mar 08 '24 17:03 howlowck