[FEAT]: Parameters to define the aliases
I like to use ?? and ?! as aliases for ghcs and ghce. At the moment I'm able to do this by first calling the alias eval and then assigning my own aliases:
eval "$(gh copilot alias -- zsh)"
alias -- '?!'=ghce
alias -- '??'=ghcs
It would however be much nicer to directly define the aliases. Something like this maybe?
eval "$(gh copilot alias --suggest='??' --explain='?!' -- zsh)"
Thank you for your support and your feedback, @she11sh0cked! ❤
If these flags for defining aliases existed:
-
Would you expect the existing functions preserved and simply add
aliasstatements to the output?$ gh copilot alias --suggest='??' --explain='?!' -- zsh ghcs() { ... } ghce() { ... } alias -- '?!'=ghce alias -- '??'=ghcs -
Are there any inputs that would be invalid or dangerous to allow being used?
- Would you expect the existing functions preserved and simply add alias statements to the output?
Yeah I think that's good. I'd suggest prepending the function with underscores though:
$ gh copilot alias --suggest='??' --explain='?!' -- zsh
_ghcs() {
...
}
_ghce() {
...
}
alias -- '?!'=_ghce
alias -- '??'=_ghcs
- Are there any inputs that would be invalid or dangerous to allow being used?
I'm not sure, but if the user provides invalid arguments they will see as soon as the eval runs, right? And sure you can do stupid stuff like alias -- 'bash', but that's definitely user fault.
Good call out about namespacing the functions. 🤔 I also agree that anything the user plugs in would be their fault if it doesn't work as expected; you should know the limitations of your shell when customizing it.
Is it possible now to define custom aliases directly instead of separately creating them?