ioquatix / script-runner

This package will run various script files inside of Atom. It currently supports JavaScript, CoffeeScript, Ruby, and Python. You can add more.
http://atom.io/packages/script-runner
Other
62 stars 23 forks source link

Expose API via the service interface #77

Open justjoheinz opened 7 years ago

justjoheinz commented 7 years ago

I like script-runner and for another plugin (language-idris), I would like to use script-runner to execute a program. The path and name for that program (an executable) is delivered by the idris repl.

It would be awesome if script-runner expose its API via the Atom service interface AND provide an additional function which would allow executing programs via a path argument (instead of using a buffer, editor etc.)

I could try (with some help) to create a PR for this. The question before I start: would such a contribution be welcome?

ioquatix commented 7 years ago

Yes, absolutely.

ioquatix commented 7 years ago

I like script-runner too and I want to update the UI. I've been sitting on it while I wait for Atom 1.19 to materialise. The terminal UI is okay, but it needs to be better integrated with the container window. There were some bugs that even caused Atom to crash (I think they are bugs in Atom/Electron though). If you can start the ball rolling on an API level integration, I'd be happy to merge. One thing I'd like more of, especially for an API, is better tests, and perhaps even an isolated package for implementing the API.

ioquatix commented 7 years ago

I've fixed some minor issues and released an update 2.1.2

I'm working on a new release 2.2 which should improve the UI quite a bit.

ioquatix commented 7 years ago

I've started experimenting with this. It's now possible to open a script runner panel using atom.workspace.open with a URI, and once you get it, you can launch a process. Launching a process still requires a little bit of effort, but you can see how to do it here: https://github.com/ioquatix/script-runner/blob/b2536d6218b1bd4a0688132179d2e55a1f2034c7/lib/script-runner.js#L78-L100

We could probably wrap it up so it was a bit nicer to use, e.g. have a high level spawn API. What do you think?