Raudius / files_scripts

Custom file actions app for Nextcloud
GNU Affero General Public License v3.0
28 stars 13 forks source link

REPL/Test #179

Open stellarpower opened 1 week ago

stellarpower commented 1 week ago

Thanks for this, opens up some powerful stuff! I usually write scripts just to run on the host but this leverages a lot better integration with the UI. The mustache and PDF stuff will be very useful. Plus I haven't got flows to work properly yet and I have no idea why, so this is probably better in most cases.

Know it might be a long shot, but would there be any possibility of a REPL, or being able to test run the script from the code editor, or something similar to speed up developing scripts?

Not being familiar with lua, it's quite time-consuming to write using only printf debugging with the add_message function. And then switching browser tabs to run it again and read the messages before they disappear.

If a full REPL would be a pain in lua (I know it's lightweight and designed for embedding, so maybe it's not really meant to run line-by-line) then I am thinking the ability to select an entry and enter relevant parameters at the bottom of the code listing, hit run, and ideally also a console output to avoid the need to send messages.

I suppose for now I can run it using occ and seems I can print in there so that's a big help.

Thanks!

Raudius commented 1 week ago

Might be possible to make something like this, will look into it for a future release.

The idea would be to add an occ command like:

occ files_scripts:interactive --user <userid>

which starts an interactive shell where you can evaluate the Lua code directly

stellarpower commented 1 day ago

That'd be useful. I think being able to access from the web interface would make it much easier to use (and on larger deployments maybe some users don't have access to the shell directly), but definitely a nice starting point. Thanks