Jump to content

Manage Homebrew Casks with Alfred


Recommended Posts

Posted

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!

Posted

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.

Posted

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.

  • 4 months later...
Posted

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>.
Posted

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.

Posted

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?

Posted (edited)

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...