cli / cli

GitHub’s official command line tool
https://cli.github.com
MIT License
36.26k stars 5.5k forks source link

Publish completions as a PowerShell module #5001

Open kilasuit opened 2 years ago

kilasuit commented 2 years ago

Describe the feature or problem you’d like to solve

Publishing gh cli completions as a powershell module to the PowerShell Gallery would allow it to be included in meta-modules like posh-cli which will help improve discoverability and installation of gh completions (tagging @bergmeister for awareness)

Proposed solution

Improve ease of installation without enforcing gh completion as part of a profile (which is preferable)

Additional context

Modifying a profile script is something that ideally is only one by the user, and not tools, by publishing gh completions for powershell as a powershell module you can couple the release of gh cli and completions as to enable seemless updates for admins and devs alike on a easier to manage scale going forward.

Ideally this should be part of your release process for each new version of the gh cli

bergmeister commented 2 years ago

I was wondering whether the new Crescendo module could be used to auto-create the completions? Tab Completion in the az CLI is a big missing feature, I know it has this special interactive feature but it's not the same experience really

mislav commented 2 years ago

Hi, as gh is capable of generating its own completion script and we have instructions how to set it up with PowerShell, I feel like we've done enough on our end to facilitate using gh effectively through PowerShell. If someone wants to publish gh as a module on PowerShell Gallery (which I've just learned about), they are welcome, but I feel for now that this should be a community project and not something that our core team maintains.

kilasuit commented 2 years ago

@bergmeister - Cresendo would be over kill when all you'd need in a build script is to dump the output of gh completion -s powershell | Out-String (as per the gh docs into a gh-completion.psm1 & then publish to the gallery on each release here

@mislav - other tooling like chocolatey for example ships with a tabcompletion poweshell module that can be used with thier cli tool and whilst I get what you mean by this (as you've done the hard work) I feel like we've done enough on our end to facilitate using gh effectively through PowerShell. I guess as I've looking at it from my angle it just feels that this could be very very easily added to your current release process as a few additional steps (preference) or with more work, likely brittle, could be externalised completely by the community.

Would you accept a PR for this into this repo if the work was to be done inside the repo? or would you generally prefer that its totally externalised and managed elsewhere?

mislav commented 2 years ago

other tooling like chocolatey for example ships with a tabcompletion poweshell module that can be used with thier cli tool

How does Chocolatey set up their completions?

I guess as I've looking at it from my angle it just feels that this could be very very easily added to your current release process as a few additional steps

That's true, but it is one more step for us to maintain. Note that we already have a lot of steps and that we are careful not to add too many more in order to avoid having our release automation become brittle.

We do like great user experiences, though, and if PowerShell Gallery would significantly improve the experience for gh users, then we could consider investing in that from this repository. Tell us, how does one use the PowerShell Gallery, how does one install updated completions after gh has a new version, etc? Please assume we aren't very familiar with the PowerShell space in general. Thank you

kilasuit commented 2 years ago

How Chocolately do it is documented in this FAQ - mirroring this I think would overall be the best approach from a release supoortability perspective

We do like great user experiences, though, and if PowerShell Gallery would significantly improve the experience for gh users, then we could consider investing in that from this repository

Significant probably is a stretch due to how much additional work it would have in it but it definitly would aid in discoverability and could be included in Posh-CLI too. Though that said releasing to the Gallery would be more aligned to how other tooling has done it like those that are detailed in the Posh-CLI repo builts by @bergmeister

So the way I would do go about this Tell us, how does one use the PowerShell Gallery, how does one install updated completions after gh has a new version, etc? would be

You could skip the publish step if you instead

The second route is likely less work to manage and maintain for you and users too, and we could in Posh-cli just add the step to add that gh-completions module

Happy to have a short call next week if you feel it would be of any additional help above and beyond what's above