Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gs conflicts with existing command (ghostscript) #469

Open
guyboltonking opened this issue Nov 11, 2024 · 8 comments
Open

gs conflicts with existing command (ghostscript) #469

guyboltonking opened this issue Nov 11, 2024 · 8 comments

Comments

@guyboltonking
Copy link

When installing using homebrew, I get a conflict because I have ghostscript (which has been known as gs for a very long time). Would it be possible to choose a different name? I've worked around this by symlinking the binary as git-spice into my ~/bin (and changing the completions using:

git-spice shell completion fish | sed -e 's/__complete_gs/__complete_git_spice/' -e 's/-c gs/-c git-spice/' | source

...), but I imagine it will hit other people.

@dvogt23
Copy link

dvogt23 commented Nov 11, 2024

yes, for me as well. Would be great to be able to create a git subcommand for spice as git absorb doing it.

@abhinav
Copy link
Owner

abhinav commented Nov 12, 2024

Hey folks, thanks for creating the issue.

I understand that the ghostscript conflict is inconvenient. I'm willing to amend the installation instructions with a warning and a workaround for ghostscript users, but I have a strong preference for keeping the current name. Renaming is not an option I'm currently open to. The current name and direct invocation (as opposed to a git subcommand) better matches the user experience I want from this tool.

RE: fixing completions with sed:
Oh, that shouldn't be necessary. The command should use its own name even when renamed. Let me fix that.

abhinav added a commit that referenced this issue Nov 12, 2024
If the command is renamed, don't use "gs" as the name in help
or in the completion script. Use the renamed command name instead.

e.g.

```
❯ make bin/gs
❯ mv bin/gs gsp
❯ ./gsp shell completion bash
complete -C /.../src/git-spice/gsp gsp
```

Refs #469
abhinav added a commit that referenced this issue Nov 12, 2024
If the command is renamed, don't use "gs" as the name in help
or in the completion script. Use the renamed command name instead.

e.g.

```
❯ make bin/gs
❯ mv bin/gs gsp
❯ ./gsp shell completion bash
complete -C /.../src/git-spice/gsp gsp
```

Refs #469
@guyboltonking
Copy link
Author

The current name and direct invocation (as opposed to a git subcommand) better matches the user experience I want from this tool.

That's a shame, because it works fine as a git subcommand as well (ln -s /opt/homebrew/Cellar/git-spice/0.8.0/bin/gs ~/bin/git-spice and you're done), and I think you'll have users (obviously I'm projecting here, but I do know at least one other developer with the same philosophy) who deliberately do not use abbreviations for already existing commands and would prefer to lean on completion for discovery. Your preferred UX excludes those users, and creates complications for people who either already have ghostscript installed, or install it in future (looking at brew uses --eval-all gs, I see imagemagick listed, which brew info tells me has ~63000 installs in the last 30 days).

In terms of a workaround, could you lean on homebrew options to provide a --with-git-subcommand option (so the default is your preferred UX, but the workaround works within homebrew instead of needing a manual symlink step)?

@abhinav
Copy link
Owner

abhinav commented Nov 12, 2024

In terms of a workaround, could you lean on homebrew options to provide a --with-git-subcommand option (so the default is your preferred UX, but the workaround works within homebrew instead of needing a manual symlink step)?

I considered that, and I don't know how strict the policy is, but per that section of the Formula Cookbook:

Note: options are not allowed in Homebrew/homebrew-core as they are not tested by CI.

Feel free to try anyway if you're up for it; if they accept the PR, I have no opposition to an install-time flag for this.

@guyboltonking
Copy link
Author

Feel free to try anyway if you're up for it; if they accept the PR, I have no opposition to an install-time flag for this.

Is the intent for this to find its way to homebrew-core then? I thought this was still your tap at https://github.com/abhinav/homebrew-tap/blob/main/git-spice.rb (happy to submit a PR, just wondering where)?

@abhinav
Copy link
Owner

abhinav commented Nov 12, 2024

Oh, I thought you were talking about the existing homebrew-core formula.
git-spice was added to homebrew-core in September (Homebrew/homebrew-core#191536).
I hadn't updated the installation instructions to refer to that because I hadn't gotten the automated brew bump-formula-pr workflow working right until, well, today.

For my Homebrew tap: goreleaser generates and pushes that formula. Goreleaser doesn't seem to have a means of adding options, but, it supports publishing multiple formulas.

So, I guess we have two options:

  • Try to add the --with-git-subcommand option into homebrew-core.
  • Publish a second git-spice-alt (or something better named) formula with goreleaser. (So mostly a copy-paste of the existing brews entry, but with a custom install step that installs the binary under a different name. Configuration reference.)

I'm open to either/both.

@guyboltonking
Copy link
Author

Ah, lightbulb moment! I strongly suspect that the homebrew maintainers mean it about options in homebrew-core, which means that the other path of an alternative formula is the more likely solution. I have no idea how to go about that, and I completely understand if you don't have the bandwidth to do it yourself.

@abhinav
Copy link
Owner

abhinav commented Nov 12, 2024

I have no idea how to go about that, and I completely understand if you don't have the bandwidth to do it yourself.

I completely understand!
I can put this on my backlog for if/when I have time/inspiration.
Meanwhile, if you or someone else would like to take a stab:

brews:
- repository:
owner: abhinav
name: homebrew-tap
token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
commit_msg_template: "{{ .ProjectName }}: Update formula to {{ .Tag }}"
commit_author:
name: Abhinav Gupta
email: [email protected]
homepage: https://abhinav.github.io/git-spice/
description: "A tool for stacking Git branches."
license: "GPL-3.0-or-later"
skip_upload: auto
test: |
system "#{bin}/gs --version"

That's the Homebrew tap configuration for git-spice.
Based on goreleaser documentation for Homebrew taps, my guess is you'd add a second entry to that list with a different name, and a different configuration for the install step.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants