-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
feat(espanso): support custom path #13977
base: main
Are you sure you want to change the base?
Conversation
Thank you for your contribution! 🎉 🔔 @kud @nbbaier you might want to have a look. You can use this guide to learn how to check out the Pull Request locally in order to test it. You can expect an initial review within five business days. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just some minor suggestions
Co-authored-by: stelo <[email protected]>
Hey folks, I appreciate the help done here. Though, I'm not sure about that.
I will look into this PR deeper soon. |
This is supposed to fix #13398. The problem there seems to be that for some reason, |
I will read the code again, to see if it's an optional field, because I don't want that all users have to mention the path of espanso when it already works. If it's a custom field where people can override it, that's alright tho. |
Will try to check this asap. |
Let me know your findings @kud, thanks for checking |
}, | ||
"scripts": { | ||
"build": "ray build -e dist", | ||
"dev": "ray develop", | ||
"fix-lint": "ray lint --fix", | ||
"lint": "ray lint", | ||
"prepublishOnly": "echo \"\\n\\nIt seems like you are trying to publish the Raycast extension to npm.\\n\\nIf you did intend to publish it to npm, remove the \\`prepublishOnly\\` script and rerun \\`npm publish\\` again.\\nIf you wanted to publish it to the Raycast Store instead, use \\`npm run publish\\` instead.\\n\\n\" && exit 1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓Does it come from a new version of Raycast?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is from a newer version of the template that I copied over
extensions/espanso/src/disable.ts
Outdated
|
||
export default async function main() { | ||
try { | ||
await $`espanso cmd disable`; | ||
await showHUD("Espanso disable"); | ||
await espanso("cmd disable"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔧 I think I would like more a helper on espanso like
await $`${espansoCmd} cmd disable`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking that using a function makes it less likely to have issues with typos, ie missing a space between }
and cmd
. I also did remove the dependency on zx
and instead use the native exec
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current way allows for only needing to import one function, rather than the path string and a function to execute the command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disagree with the typo issue, tho, I'm happy to remove the zx dependency here to make it lighter. Tho, not sure I won't take it back if I need it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you tho change the name of the function like espansoShell
or espansoCli
, something like that?
Oops, forgot to push the commit I made three days ago. I've replied to the comments. |
Ah, so everything should be resolved 🙂 @kud can you check again 🙂 |
extensions/espanso/src/disable.ts
Outdated
|
||
export default async function main() { | ||
try { | ||
await $`espanso cmd disable`; | ||
await showHUD("Espanso disable"); | ||
await espanso("cmd disable"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disagree with the typo issue, tho, I'm happy to remove the zx dependency here to make it lighter. Tho, not sure I won't take it back if I need it.
extensions/espanso/src/disable.ts
Outdated
|
||
export default async function main() { | ||
try { | ||
await $`espanso cmd disable`; | ||
await showHUD("Espanso disable"); | ||
await espanso("cmd disable"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you tho change the name of the function like espansoShell
or espansoCli
, something like that?
@erics118 Please check those comments 🙏 |
I've renamed |
import { exec } from "child_process"; | ||
|
||
function execAsync(command: string): Promise<{ stdout: string; stderr: string }> { | ||
return new Promise((resolve, reject) => { | ||
exec(command, (error, stdout, stderr) => { | ||
if (error) { | ||
reject(error); | ||
return; | ||
} | ||
resolve({ stdout, stderr }); | ||
}); | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like
import { exec } from "child_process";
import { promisify } from "util";
const execAsync = promisify(exec);
could be probably better.
? "/opt/homebrew/bin/espanso" | ||
: "/usr/local/bin/espanso"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we could test first if it exists because not everyone installs it via homebrew.
Wonder if we could check first if the shortcut command espanso
exists and once it does not exist, test first the preference and then the homebrew version.
Could you check again @kud 🙂 |
The last two comments have not been resolved or discuted. @pernielsentikaer @erics118 |
Sorry, I was working on it and had mistakenly resolved them before actually committing the code. I'll update later today |
Let me know if I can help you with anything |
@pernielsentikaer For now, there is only one user who has an issue, and it's not even certain there's a way to fix it, but it's worth trying. If it takes too much time to resolve, I will fix my own suggestions. Thanks for asking! |
This pull request has been automatically marked as stale because it did not have any recent activity. It will be closed if no further activity occurs in the next 7 days to keep our backlog clean 😊 |
So we should just merge this one? |
@pernielsentikaer To be honest, I'm kind of against this PR because of a responsibility concern where this issue should be fixed by the user in their shell. I'm happy to accept it if it can help some users (how many?) to fix the issue by specifying the path of the Espanso CLI, but here we override the path of Espanso by default, which is not great because all the people who installed the app without Homebrew could have an issue now. So yeah, I'm not in the rush to merge it 😬 |
My question is why do we need to force it in the code? Is there a way that we could help users to fix their shell issue? I know raycast uses its own shell or at least not the logged one. I'm happy to add a documentation to fix this path issue in the README. |
Did you resolve your question with the command from George on Slack |
@pernielsentikaer I think I've got an idea yeah. Lemme work on that PR. 😌 |
Can we close this one? |
Lemme double check. @acicovic Do you still have the issue? |
I can confirm that I still have the issue. To work around this, I'm using Espanso's search bar outside of Raycast. |
Description
Add a preference option to support custom location to espanso CLI.
Screencast
Checklist
npm run build
and tested this distribution build in Raycastassets
folder are used by the extension itselfREADME
are placed outside of themetadata
folder