Repository navigation
Support aliases deeper than top level, e.g. gh pr co #1303
Description
Activity
Hi, thanks for explaining how you're using gh!
Would it be an option for you to create a gh alias for
pr checkout? E.g.$ gh alias set co 'pr checkout' $ gh co 123In fact, I believe that we ship with this alias as default for new users who are installing GitHub CLI.
- addedmore-info-neededMore info needed from user/contributorMore info needed from user/contributor
on Jul 1, 2020 gh alias set co 'pr checkout'works - thanks, @mislav. I didn't realisealias setwas a thing. 😳I did try out
gh alias set 'pr co' 'pr checkout', which doesn't seem to work. But I understand that keeping theprnamespacing is perhaps not the preferred way (even though it makes more sense to me ascooperates on PRs in this case).@issyl0 You're right, right now aliases are only supported at "top-level" and not nested under a command such as
pr. We could potentially support nested ones too, but I don't see why someone would create a 2-word alias when they can create a 1-word one.Do you feel that this can be closed or that we should keep it open as a feature request?
Thanks for your responses. This is fine to close. If
gh costill seems weird in a week or two, I can keep my local change to supportgh pr co.Reacted by Oliver KoppSame here. In my usage case, I've tried to define
gh issue mineasissue list --author pataquets. Ended up implementing it asissue.mine, but supporting deeper aliases would open some meaningful shortcuts for common switches as described.
@mislav: I would like to ask this issue to be left open to keep track of it, in case sometime in the future it could be implemented, although I understand it might not be a priority now.Reacted by Mathieu TUDISCOThat's a good point! Reopening
- changed the title
[-]Alias `gh pr checkout` to `gh pr co`[/-][+]Support aliases deeper than top level, e.g. `gh pr co`[/+]on Feb 23, 2021 - removedmore-info-neededMore info needed from user/contributorMore info needed from user/contributor
on Feb 23, 2021 - addedcoreThis issue is not accepting PRs from outside contributorsThis issue is not accepting PRs from outside contributors
on Mar 8, 2021 The same here.
I was trying to addgh pr browseforpr view -wlike we havegh browse.Just wanted to drop my use-case in this issue (I didn't see it when I opened my own!).
I have
gh goaliased togh repo view --web, but I'd like to extend that to other commands (e.g.gh pr goforgh pr view --web). I could do something likegh prgo(one word) but it's more natural to me to think ofgo=view --web.Reacted by Mathieu TUDISCOIs this the place to ask for
gh pr co {num}out of the box.In the default setting one needs to omit
pr, which is confusing (because it is not consistent why one needs to writecheckoutin one place andcoin another place although both terms have the same effect)$ gh pr co 13280 unknown command "co" for "gh pr" $ gh co 13280 remote: Enumerating objects: 178, done.
@koppor I'd say you should make a new issue for that. We could always add new default aliases, but need to discuss it.
Describe the feature or problem you’d like to solve
I type
gh pr checkoutmany times a day. Typingcheckoutis long. I have shell aliases forgit checkout:gco. That muscle memory could carry over togh pr checkouttoo, with thegh pr cocommand alias.I'd like to think that this affects many people using
gh pr checkout: not just me. But I've not done any research to verify that thought.Proposed solution
Add an alias for
coto thepr_checkoutcommand.I considered some alternatives, like the existing tab completions. While they do work as intended,
gh pr c<tab><tab>andgh pr ch<tab>take three keypresses, and are different from the "usual"coabbreviation forcheckout.I've got the change ready to go locally - but as per the contributing guide, I'm submitting an issue first to see if there's an appetite for this!
Additional context
Thanks for building the
ghtool!