Jump to content
pstadler

Manage Homebrew Casks with Alfred

Recommended Posts

Yes, it loaded it fine from the command line, but not from this workflow. Everything I have tried today has failed, but works from the command line. I believe it has to do with permissions, but I am not sure. But, I can use it to browse available casks!

Share this post


Link to post

Trying too, but my attempts of capturing the output are not working. I guess it is putting it out on stderr and I am not good at bash for capturing stderr. I have a python program I use to catch cli outputs, but it is not getting the stderr.

Share this post


Link to post

I got it working. I added a line to source my bashrc file and it works great. You might want to add that to the workflow since Alfred does not launch scripts in a way the the configuration scripts are loaded.

Share this post


Link to post

There’s another consideration here. By not sourcing the users’ shell startup files, it can possibly behave differently than from the command line, as it won’t be including homebrew-cask’s options. A warning on the top post that users will need to reproduce these in the workflow (if they have any of them set) would be a good idea, as not doing it can mess organisation quite a bit, like installing and linking to different directories.

On another note, you have some unnecessary code in the workflow. You’re doing

#!/bin/bash

sh cask.sh <arguments>
However, #!/bin/bash is not needed, as Alfred is already taking care of using the correct interpreter. Furthermore, by issuing sh cask.sh you’re actually telling the shell to call another shell to execute the script. You should make the script executable (once, on your side, via chmod +x ./cask.sh), and substitute sh cask.sh <arguments> in the workflow with ./cask.sh <arguments>.

Share this post


Link to post

Apologies if it was insulting in any way. I don’t intend to use the workflow, but as a homebrew-cask collaborator and avid Alfred user, it interested me, which is why I mentioned the options case as that can break the workflow of unsuspecting users.

It is also so common in these forums (due to Alfred’s workflows being so powerful an easy to use) to find users with little scripting experience (which I now see is not your case), that I got into the habit of explaining in detail how (and why) to make suggested changes. Making code shorter and at the same time more efficient is always good, and my point is simply that Alfred is already good at making some right decisions for us.

Share this post


Link to post

No worries, I'm not insulted and I agree with you.

 

As a contributor to the homebrew-cask project and the guy who wrote the brew-cask plugin bundled with oh-my-zsh, I hope you keep up the good work! There's definitely potential in this project. Are there any plans regarding a GUI app for the non-devs out there?

Share this post


Link to post

I just pushed a new version.

 

Changes:

- ~/.bash_profile and ~/.profile are now sourced if available (thanks andi-w00t)

- cask.sh is now executed without spawning a subshell.

Edited by Patrick Stadler

Share this post


Link to post

Are there any plans regarding a GUI app for the non-devs out there?

 

Not officially, at least for the time being. Cakebrew could possibly do it, though.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...