jpillora / installer

One-liner for installing binaries from Github releases
https://i.jpillora.com/installer
MIT License
206 stars 52 forks source link

The GitHub CLI gets installed as cli instead of gh #26

Closed philipsd6 closed 1 year ago

philipsd6 commented 1 year ago

The GitHub CLI repo is cli/cli so we run the curl command:

curl -s "https://i.jpillora.com/cli/cli!!" | bash -x

and see that it installs gh as cli:

+ echo 'mv with sudo...'
+ sudo mv ./gh_2.19.0_linux_amd64/bin/gh /usr/local/bin/cli
+ echo 'Installed at /usr/local/bin/cli'

Is there any way to ensure the binary is installed as gh? It seems to me that the script could just do this instead:

+ sudo mv ./gh_2.19.0_linux_amd64/bin/gh /usr/local/bin/

i.e. move into the target directory instead of to a target file, but I'm not sure if that would adversely affect different repo's releases. My current workaround is to follow up with a sudo mv /usr/local/bin/{cli,gh}.

jpillora commented 1 year ago

Yea this is a tricky one, i encountered repos which have the reverse problem - they have a generic name for the binary so I want to use the repo name

Can’t think of examples though so maybe this a reasonable change…

On Fri, 4 Nov 2022 at 4:54 am Philip Douglass @.***> wrote:

The GitHub CLI repo is cli/cli so we run the curl command:

curl -s "https://i.jpillora.com/cli/cli!!" | bash -x

and see that it installs gh as cli:

  • echo 'mv with sudo...'
  • sudo mv ./gh_2.19.0_linux_amd64/bin/gh /usr/local/bin/cli
  • echo 'Installed at /usr/local/bin/cli'

Is there any way to ensure the binary is installed as gh? It seems to me that the script could just do this instead:

  • sudo mv ./gh_2.19.0_linux_amd64/bin/gh /usr/local/bin/

i.e. move into the target directory instead of to a target file, but I'm not sure if that would adversely affect different repo's releases. My current workaround is to follow up with a sudo mv /usr/local/bin/{cli,gh}.

— Reply to this email directly, view it on GitHub https://github.com/jpillora/installer/issues/26, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAE2X43QDIW5P6DY4TSTEHLWGP335ANCNFSM6AAAAAARWMXVEE . You are receiving this because you are subscribed to this thread.Message ID: @.***>

philipsd6 commented 1 year ago

The only other option I see is to add another optional param ?name=gh to the API to override the default.

jpillora commented 1 year ago

Oyea that’sa good idea, or ?as=mycli (install as mycli)

are you able to PR? Either param name works for me

philipsd6 commented 1 year ago

As requested, I made a PR, but as I've never done anything in Go, I can only hope I did it right. :)

philipsd6 commented 1 year ago

Works! \o/

$ curl -s "https://i.jpillora.com/cli/cli!!?as=gh" | bash
Installing cli/cli v2.20.0 as gh (linux/amd64).....
######################################################################## 100.0%
mv with sudo...
[sudo] password for philipsd6:
Installed at /usr/local/bin/gh