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

Docs: Suggestion to add shell script as a way to open git-cola on mac #1400

Open
kopach opened this issue Jun 5, 2024 · 4 comments
Open

Comments

@kopach
Copy link
Contributor

kopach commented Jun 5, 2024

Currently in order to open git-cola on Mac not from terminal - we need to build a binary. Problem with this solution is that such app can become outdated while CLI version can be easily kept up to date with regular scheduled brew update

The solution for this - using shell script instead. Using Mac native Automator app we can create Application which will run shell script
image
image

We can name such app Git-Cola, assign logo to such app and it won't be outdated.

Here is a script to place into automator. It will open git-cola or will bring it to the front if it's already open

git_cola_path=$(which git-cola)
if pgrep -f "$git_cola_path" >/dev/null; then
	osascript -e "tell application \"System Events\" to set frontmost of (first process whose unix id is (do shell script \"pgrep -f "$git_cola_path"\")) to true"
else
	"$git_cola_path" >/dev/null 2>&1 &
fi
exit 0

I suspect, we can even automate such Automator action somehow (something to check)


Another option (for users of Alfred or Raycast) - such script can be added directly to those apps as custom scripts/workflows

@davvid
Copy link
Member

davvid commented Jun 12, 2024

Thanks for the sug. I'll have to look into this. The current git-cola.app launcher is basically a shell script under the hood already so providing something like this by default seems like a good idea.

The homebrew folks didn't let me add the git-cola.app bundle to the distribution (bad call, IMO) so something like this would be a great solve for that since it would lets us delegate to the homebrew-managed version rather than having to manage two separate things.

If you want to try building it, garden macos/app is how I build the app bundle. All the guts are in contrib/darwin/ and the current shell script is contrib/darwin/git-cola.

I'd probably still want to offer a standalone version (e.g. garden macos/app-standalone can be set aside to build it the current way) but the default will be to delegate to homebrew like you have in your example above. With that in mind, I'd probably suggest copying the current script to contrib/darwin/git-cola-standalone and then your new script can replace the current contrib/darwin/git-cola and the recipes in garden.yaml can be tweaked accordingly.

@kopach
Copy link
Contributor Author

kopach commented Jun 12, 2024

The homebrew folks didn't let me add the git-cola.app bundle to the distribution

@davvid, could you elaborate this one, please? Is it also applicable to https://github.com/Homebrew/homebrew-cask or you haven't considered that yet?
If not - we could add that and make git-cola easy installable on mac.
Casks are designed to be for *.app files (with limitations like no versioning but also benefits like no need to bundle binary during install).
Casks can be installed automatically via brew install <app-name> (previously brew --cast install <app-name>)

@kopach
Copy link
Contributor Author

kopach commented Jun 12, 2024

Here is an example of Bitwarden being added to cask repo Homebrew/homebrew-cask#44084
I can help and raise PR there if you want but it's important for this repo to have *.app bundled during release and included in each release so it's possible to reference the exact download link for the app in homebrew-cask file

@davvid
Copy link
Member

davvid commented Jun 13, 2024

The issue I'm referring to is #1322.

Thanks for the offer, @kopach that'd be great if we could maybe get a github action to build the app bundle and have that accepted as a separate, differently-named cask.

Now, I will say that I want the ideal situation. git-cola has been in homebrew for a long time, back before casks existed. My definition of "ideal" is that users could just upgrade their existing install and they'd get the app bundle. Similarly, new users should be able to simply brew install git-cola and get both the command-line tools and the app bundle.

The linked issue above is where I attempted to update the existing git-cola formula to include the app bundle and they rejected it.

I suspect that the only thing they might accept is something silly like a separate brew install --cask git-cola-app formula which would be an extra step for users, which is why I personally consider it not-ideal and silly.

That said, if they'd accept that then it's better than nothing. I don't want to disrupt the current formula or make it unavailable (or transfer it to a cask). I want both the command-line tools and the app bundle launcher, but homebrew follows some strict policy where they don't allow that for some silly reason, users be damned.

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

No branches or pull requests

2 participants
-