RefactorFirst icon indicating copy to clipboard operation
RefactorFirst copied to clipboard

Provide CLI version

Open jimbethancourt opened this issue 4 years ago • 7 comments
trafficstars

@aalmiray suggested the idea of a CLI version: https://twitter.com/aalmiray/status/1417549718419300358?s=20 Let's do it! Table output could be generated on the command line using one of the libraries mentioned on https://github.com/akullpp/awesome-java#cli

Adding to SDKMan will be taken up in a separate issue - let's get this done first.

jimbethancourt avatar Sep 22 '21 01:09 jimbethancourt

That will be amazing! Basically, I'd like to try RefactorFirst with some projects, and using it via CLI will be so easy, because then I'll not need to change any dependency or start using maven (for example, if the project is managed via gradle, etc)

icougil avatar Oct 01 '21 16:10 icougil

I can certainly craft a PR to get the base code in place however @jimbethancourt I'm afraid this will require some knowledge transfer for both Maven and PicoCLI. If it's OK with you I can work on a PR, set it as draft, then we review together (Zoom or other) til you're satisfied.

aalmiray avatar Oct 01 '21 16:10 aalmiray

You're too kind to offer @aalmiray! I came across https://github.com/remkop/picocli/tree/master/picocli-spring-boot-starter -- I'm pretty familiar with Spring Boot and the Spring beans could be used in both the CLI and webapp versions (unless you think this won't make things easier and makes you wince 😆).

jimbethancourt avatar Oct 05 '21 01:10 jimbethancourt

Oh goodie, yes, if you'd like to continue using PicoCLI + Spring then sure, let's go. I was thinking more into the particular setup for Maven modules, crafting a release likely using GitHub Actions, and other stuff.

aalmiray avatar Oct 05 '21 14:10 aalmiray

FWIW here's a sample Spring Boot project (no PicoCLI at the moment) that shows the minimum settings for packaging as native executables (with GraalVM Native Image), generate all executables with GitHub Actions, and releasing with JReleaser

https://github.com/aalmiray/sb-cli

Should you want to keep the CLI as regular Java instead of native executable then I'll have to make asime adjustments 😉

aalmiray avatar Oct 25 '21 12:10 aalmiray

Thank you @aalmiray! This is great! I was thinking of using the Spring Native plugin -- I've done some work with it before and I'm somewhat familiar with it. I'll give it a go soon 😄

jimbethancourt avatar Oct 27 '21 00:10 jimbethancourt

Hello, I have created a draft pull request where I started to refactor the code, so reporting logic could be reused in maven/gradle plugins or CLI application. I did not change any behavior, just migrated some classes to a new module, and stripped away maven-core logic from classes that generate reports. It would be nice if you could review this code for now, so that I know I am on the right track before I continue making CLI application.

d4c4nf3 avatar Jul 09 '23 20:07 d4c4nf3