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

Unable to generate lorem ipsum #6

Closed
wirtzdan opened this issue Nov 19, 2021 · 27 comments
Closed

Unable to generate lorem ipsum #6

wirtzdan opened this issue Nov 19, 2021 · 27 comments

Comments

@wirtzdan
Copy link

I have this strange bug, that I can't choose one of the options anymore.

It always brings me to the search.

Video:
https://cln.sh/nIW3Yw

CleanShot 2021-11-19 at 09 04 05

Any idea how to solve this?

@rverrips
Copy link

I had this exact issue a few days ago and Till released a new version to fix it.
Which version are you running?

#5

@ruudvanham
Copy link

Same issue here, just updated alfred and imported the latest workflow. v0.2.1

@rverrips
Copy link

rverrips commented Dec 3, 2021

Just to confirm @ruudvanham - you are saying your issue was fixed by using the latest version (v0.2.1) of the workflow?

Also, @wirtzdan : Is your issue resolved with the update to v0.2.1?

@tillkruss
Copy link
Owner

I'm confused too.

@ruudvanham
Copy link

No sorry, i'm still having the issue, even after updating alfred and the workflow to the latest versions

@tillkruss
Copy link
Owner

What's your Alfred and macOS version?

@ruudvanham
Copy link

Alfred: v4.6.1 [1274]
Lorem Ipsum: v0.2.1
MacOs: Monterey 12.0.1

@cgpro
Copy link

cgpro commented Dec 8, 2021

Same issue here. If I type "lor" and accept the first option "paragraphs" a google search will be started.

Expected behaviour:
Copy a lorem text into clipboard. ;-)

@tillkruss
Copy link
Owner

@ruudvanham @cgpro Are you two on Intel or M1 chips?

Do you have have PHP installed via Homebrew?

@cgpro
Copy link

cgpro commented Dec 8, 2021

Nope:
macOS MOnterey (12.0.1)
iMac (Retina 5K i7 end 2015 > Intel)

$ php -v PHP 7.4.12 (cli) (built: Nov 30 2020 13:28:43) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies

Don't know how I installed this PHP-Version anymore.

@tillkruss
Copy link
Owner

Could you run which php for me to reveal the path?

@cgpro
Copy link

cgpro commented Dec 9, 2021

It's the version from MAMP
$ which php php: aliased to /Applications/MAMP/bin/php/php7.4.12/bin/php -c "/Library/Application Support/appsolute/MAMP PRO/conf/php7.4.12.ini"

@tillkruss
Copy link
Owner

Can you go into your workflow and try this script instead?

if [ -f "/opt/homebrew/bin/php" ]; then
    /opt/homebrew/bin/php loremipsum.php "words" "{query}"
elif [ -f "/usr/local/bin/php" ]; then
    /usr/local/bin/php loremipsum.php "words" "{query}"
elif [ -f "/usr/bin/php" ]; then
    /usr/bin/php loremipsum.php "words" "{query}"
else
    php loremipsum.php "words" "{query}"
fi

@cgpro
Copy link

cgpro commented Dec 9, 2021

Nope, after typing 'lorem words' alfred want to perform a google search.

Bildschirmfoto 2021-12-09 um 19 36 46

If I type 'lorem wor':

Bildschirmfoto 2021-12-09 um 19 45 43

If you want, we can do a call with screen sharing, if you can't reproduce it. Maybe its a setting? (not changed/updated after an update maybe)

@tillkruss
Copy link
Owner

When you debug the workflow in Alfred, are you seeing any errors?

Screen Shot 2021-12-10 at 9 07 41 AM

@cgpro
Copy link

cgpro commented Dec 10, 2021

This works in combination Language /bin/zsh (and not bin/bash)

if [ -f "/opt/homebrew/bin/php" ]; then /opt/homebrew/bin/php loremipsum.php "words" "{query}" elif [ -f "/usr/local/bin/php" ]; then /usr/local/bin/php loremipsum.php "words" "{query}" elif [ -f "/usr/bin/php" ]; then /usr/bin/php loremipsum.php "words" "{query}" else /Applications/MAMP/bin/php/php7.4.12/bin/php loremipsum.php "words" "{query}" fi

Bildschirmfoto 2021-12-10 um 20 38 27

@tillkruss
Copy link
Owner

@cgpro: Can you post the raw output of which php? Ideally a screenshot of your terminal?

@cgpro
Copy link

cgpro commented Dec 14, 2021

Bildschirmfoto 2021-12-14 um 20 16 52

@nicooprat
Copy link

I had to manually replace the script PHP location:

% which php
/opt/homebrew/opt/php@7.4/bin/php

image

I'm not familiar with bash scripts, but it would be better to avoid hardcoding every possible PHP location in the script itself... Can't we use the output of which php to use it right away?

Anyway for now it works again, hope it helps.

@tillkruss
Copy link
Owner

@nicooprat: I don't think we can, but we can use it as the fallback.

if [ -f "/opt/homebrew/bin/php" ]; then
    /opt/homebrew/bin/php loremipsum.php "words" "{query}"
elif [ -f "/usr/local/bin/php" ]; then
    /usr/local/bin/php loremipsum.php "words" "{query}"
elif [ -f "/usr/bin/php" ]; then
    /usr/bin/php loremipsum.php "words" "{query}"
else
    php loremipsum.php "words" "{query}"
fi

Can you give this one a try if it works?

@rverrips
Copy link

rverrips commented Jan 5, 2022

This might be an option - I tested with this on my Mac and it worked ok.

Should however add an else for error catching.

if [ -f "$(which php)" ]; then
    $(which php) loremipsum.php "words" "{query}"
fi

@nicooprat
Copy link

@rverrips Could you explain what you did exactly? I just tried it (with bash & zsh), but with no luck:

$(which php) loremipsum.php "words" "{query}"

image

@tillkruss
Copy link
Owner

@rverrips /bin/bash may not have php in its PATH.

@tillkruss
Copy link
Owner

tillkruss commented Jan 6, 2022

I wonder if this would cover enough cases:

if [ -f "/opt/homebrew/bin/php" ]; then
    /opt/homebrew/bin/php loremipsum.php "words" "{query}"
elif [ -f "/usr/local/bin/php" ]; then
    /usr/local/bin/php loremipsum.php "words" "{query}"
elif [ -f "/usr/bin/php" ]; then
    /usr/bin/php loremipsum.php "words" "{query}"
elif [ -f "$(which php)" ]; then
    $(which php) loremipsum.php "words" "{query}"
else
    php loremipsum.php "words" "{query}"
fi

That would allow people to link php as an alias even.

@rverrips
Copy link

rverrips commented Jan 6, 2022

@rverrips Could you explain what you did exactly? I just tried it (with bash & zsh), but with no luck:

$(which php) loremipsum.php "words" "{query}"

image

Apologies @nicooprat and @tillkruss ... My hope was that $(which php) would execute the string returned from (which php), i.e. current php binary.

This works in "regular" bash, sh and zsh, but seems this does not work within the Alfred script execution - Apologies for the wild goose chase

Like the issues we have with various paths to php, it seems Alfred can't find which either ... sigh

(Please disregard my suggestion to use $(which php))

@tillkruss
Copy link
Owner

The /bin/bash used by Alfred seems capable of which php and command -v php, but php may not be in the bash path.

@tillkruss
Copy link
Owner

I've tweaked this in v0.2.2. Please re-open if the issue persists.

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

6 participants