I’m sure we can get to the bottom of it together. To start with, I suggest enabling extension debug output so you can view any error output from the script in the Console, as per Debug output.
As an example, the screenshot below shows what I get when I run your snippet. However, I do not have a groq-cli command in my path so this error iis to be expected in my case (I web searched it, but there seem to be many things called that, so I didn’t go further.)
Stderr:
Traceback (most recent call last):
File “/Users/garythompson/.local/bin/groq-cli”, line 10, in
sys.exit(main())
~~~~^^
File “/Users/garythompson/Documents/python_local/uv_projects/groq_cli/src/groq_cli/init.py”, line 113, in main
cli()
~~~^^
File “/Users/garythompson/.local/share/uv/tools/groq-cli/lib/python3.13/site-packages/click/core.py”, line 1161, in call
return self.main(*args, **kwargs)
~~~~~~~~~^^^^^^^^^^^^^^^^^
File “/Users/garythompson/.local/share/uv/tools/groq-cli/lib/python3.13/site-packages/click/core.py”, line 1082, in main
rv = self.invoke(ctx)
File “/Users/garythompson/.local/share/uv/tools/groq-cli/lib/python3.13/site-packages/click/core.py”, line 1697, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File “/Users/garythompson/.local/share/uv/tools/groq-cli/lib/python3.13/site-packages/click/core.py”, line 1443, in invoke
<…>
It appears that my snippet isn’t passing the text along to my cli app which is written in Python.
Normally in the terminal if the command doesn’t get any input it returns a help message and exists gracefully so I’m not sure what is going on.
As aside, I’m curious why the text needs to be URL-encoded when in your example "Check this" is not url-encoded and URL-encoding is not a common requirement for CLI tools. Could this be anything to do with the problem?
I suspect the text isn’t being sent because when I was developing the cli I would get the same errors until I added additional try/except calls. What’s weird though is the call from the snippet is triggering the same error I used to get when I was initially developing the tool.
What I sent you is what the console app showed for the error. I see the same truncating in the “Launching Task” entry which leaves off the POPCLIP_URLENCODED_TEXT entry.
Do you know of any way to force the console to show the entire error/message?
As for the url encoding a lot of times there are single and double quotes in the text I’m ingesting which breaks the command. It runs fine if url encoding is applied. In fact I just tried the exact url encoded text on the command line I was sending via the snippet and it worked fine.
I also have a test snippet that echos back the url-encoded text perfectly:
#!/bin/zsh
# #popclip
# name: Helloworld in zsh
# after: show-result
echo -n "${POPCLIP_URLENCODED_TEXT}!" # `-n` for no newline at end
and it still errors out without passing any url encoded text. Could this have anything to do with the arguments I am passing to the cli causing some kind of issue?
I suspect it might be something PopClip is doing wrong rather than something you are doing wrong. Is the groq-cli tool you are using publicly available? If so, where can I get it? I would like to grab it so I can test these snippets out myself.