SFC Posted February 20, 2015 Share Posted February 20, 2015 Apologies if this is somewhere obvious and my searchfu is just weak today. I'm trying to figure out how within a workflow script, I can set a custom location for the "language". For example - by default if a script uses php, the language location is /usr/bin/php. The default OSX php version is old, and I've installed the brew version. I'd like to be able to easily set the language to /usr/local/opt/php56/bin/php where I have my brew version installed. I'm not seeing an obvious way to do so. If there isn't an easy way to do so, any chance the feature can be added? If there is an easy way to do so and I just missed it, shaming welcome. Link to comment
Andrew Posted February 21, 2015 Share Posted February 21, 2015 Apologies if this is somewhere obvious and my searchfu is just weak today. I'm trying to figure out how within a workflow script, I can set a custom location for the "language". For example - by default if a script uses php, the language location is /usr/bin/php. The default OSX php version is old, and I've installed the brew version. I'd like to be able to easily set the language to /usr/local/opt/php56/bin/php where I have my brew version installed. I'm not seeing an obvious way to do so. If there isn't an easy way to do so, any chance the feature can be added? If there is an easy way to do so and I just missed it, shaming welcome. To use a specific script language (or location), the best thing to do is select one of the built in ones (e.g. bash) and then bootstrap over to the language you would like to use. Alfred sets the pwd to the workflow's folder so you could do something as simple as: /usr/local/opt/php56/bin/php ./scriptname.php "{query}" ...where scriptname.php is a script stored in the workflow's folder. There are a quite a few workflows which already do this, so you aren't alone! Cheers, Andrew Link to comment
rice.shawn Posted February 23, 2015 Share Posted February 23, 2015 If you do this and you decide to distribute the workflow, then make sure check that the alternative language binary exists: if [ -f '/usr/local/opt/php56/bin/php' ]; then php_bin='/usr/local/opt/php56/bin/php' else php_bin=$(which php) fi $php_bin scriptname.php "{query}" Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now