github / gh-copilot

Ask for assistance right in your terminal.
https://docs.github.com/en/copilot/github-copilot-in-the-cli
760 stars 31 forks source link

[FEAT]: `ghcs` should allow for interactive target selection #58

Open williammartin opened 7 months ago

williammartin commented 7 months ago

Describe the need

I used to run gh copilot suggest and would be presented with an interactive option to choose my target (gh/git/shell). Now I use the ghcs alias and it defaults to the shell target. This can be modified with -t to set another but I don't want to provide this at invocation time, and would prefer to select interactively.

Version

➜  ~ gh copilot version
gh-copilot version 1.0.1 (2024-03-22)

Relevant terminal output

➜  ~ ghcs

Welcome to GitHub Copilot in the CLI!
version 1.0.1 (2024-03-22)

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

? What would you like the shell command to do?
>

CC: @Ali-thepro

colinshum commented 7 months ago

@williammartin thanks for the feedback!

I've added this to our board for internal discussion and we'll keep this issue updated along the way.

DevAtDawn commented 3 months ago

@williammartin @colinshum https://github.com/DevAtDawn/gh-copilot-alias-support/tree/main made a work around for interactive target selection, it temp removes the -t flag when running ghcs

# fish
function ghcs_interactive_option 
    functions ghcs | sed "s/ \-t \"\$TARGET\"//" | source
end

# bash
eval "$(declare -f ghcs  | sed 's/ -t "\$TARGET"//')"

#zsh
function ghcs_interactive_option {
    functions ghcs | sed 's/ -t "\$TARGET"//' | source /dev/stdin
}