Interact with plugin through CLI?

Answered

Hello there! 

I'm building a plugin to create a new project wizard type. It looks pretty similar to the standard ones provided by IntelliJ already. The plugin is already (mostly) working.

However, I'd also like the option to interact with this plugin through a command line, or 'terminal' if you like, instead of the normal GUI that Intellij provides. 

Ideally, I'd build this CLI interaction in a language like Go or Rust. If a JVM-based language is absolutely necessary though I'd understand.

I did a lot of googling and searching around but couldn't find an answer to this.

 

Cheers,

Ares

 

0
11 comments

Hej there,

one possible route could be your plugin exposing e.g. a REST service that your CLI apps interact with.

1

Hi, thanks for your reply! I did consider exposing a REST service. I wanna use that as a last resort in case there was a different approach. If all else fails, I may have to go that route. 

Edit: I don't know if it's possible to 'reply' to people's comments specifically. Couldn't find a button for that.

0

Your plugin will need to expose such an API by itself.

0

Hi Yann, thanks for your reply! To clarify, are we still talking about a REST API here inside the plugin or something more along these lines: https://plugins.jetbrains.com/docs/intellij/bundling-plugin-openapi-sources.html

If not, can you please clarify what you mean?  

0

Hej Ares,

I think replying to specific messages is not possible,

If you go down the service route you can take a look at class RestService and implementors of EP com.intellij.httpRequestHandler in IntelliJ Platform Explorer.

1

Hey, thanks! I'll definitely check that out. In the meantime, I found a few examples that use the interface "com.intellij.openapi.application.ApplicationStarter". 

I'll explore both routes to see which one works better.

 

Edit: I did reply to Yann but that comment is apparantely waiting for approval.

0

Ares, I meant "API" as a general term - whatever interface/technology your plugin will use to 3rd party clients.

0

Aha, thank you for clarifying! I do wonder.. how I would expose my plugin to a 3rd party client. The only resources I could find are how to expose one plugin to another. Do you have an example of this or a link to a resource I'm maybe missing? 

0

I'm not aware of any good examples.

0

Ah, that's a shame. Do you, without an example, have a push in the right direction of where (or how) I can start to expose an API from my plugin to the outside world? 

0

Sorry, no specific pointers, I'd assume you can use any Rest-API library or similar

0

Please sign in to leave a comment.