Open palmin opened 6 years ago
Great idea! I also like the key
parameter idea.
This in combination with Workflow would open so many possibilities.
I have a feeling changes are coming to how commands are processed to facilitate script files and such and that it would be better to wait before implementing invoking commands through x-callback-url.
My strategy will pretty much be:
1) parse x-callback-url and write the contents of the input
parameter to a temporary file.
2) invoke the command where stdin is redirected from the temporary file and such that stdout and stderr are redirected to two other temporary files.
3) depending on status code of command, the x-success or x-error callback is made with content of the respective temporary file.
Depending on how scripting ends up working, the command might also be put in a temporary script file if this could make redirection cleaner for composite commands.
I am open to using a different strategy. I'm writing this up to get feedback before doing a lot of work.
I think it would be useful to be able to run commands in OpenTerm from other apps through x-callback-url, which is sort of the reverse of issue #26.
Imagine something along the lines of:
The
command
parameter is the command that is executed, whileinput
is passed tostdin
. Depending on the status code of the command eitherx-success
orx-error
callbacks are done with the text result from eitherstdout
orstderr
.Since commands can do all sorts of things, it would probably be best to have a
key
parameter with a random password like Drafts and Working Copy have, such that users are not tricked into running malicious commands.How would you feel about such a feature?
Anything you would like me to consider?