Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CLI support #156

Closed
bbottema opened this issue Jul 22, 2018 · 9 comments
Closed

Add CLI support #156

bbottema opened this issue Jul 22, 2018 · 9 comments

Comments

@bbottema
Copy link
Owner

bbottema commented Jul 22, 2018

Simple Java Mail should Command Line Interface (CLI) support.

Considering the mantra that the builder API is the absolute single source of truth (including for documentation), CLI should be based on that. The CLI support should support all the API that require simple parameter values (String, ints, etc.) or values that can easily be converted (InetAddress is a no-go, but Email can be converted from EML string for example).

Considering the CLI should always reflect the builder API, it would be great if the CLI commands can be generated from the builder Java classes (using annotations).

Furthermore, the CLI support should support basic file/url handling. With the builder API that was the responsibility of the user (passing in DataSource instances for example, or byte arrays), but with the CLI that responsibility is moved back for basic support at least. This means the builder API needs to become even more robust than it is now, to accommodate CLI support comprehensively.

Solves #142.

@bbottema
Copy link
Owner Author

I have a poc working in the "cli-support" branch, which uses picocli.

Currently working out some bugs/improvements with the picocli maintainer (issues are: remkop/picocli#430, remkop/picocli#433 and remkop/picocli#441), but it is progressing quite fast (thanks to @remkop).

After these issues have been resolved, I will flesh out the complete builder API in the CLI support.

@bbottema
Copy link
Owner Author

bbottema commented Aug 27, 2018

There's a library out there that is able to include Javadoc at runtime, which would be a perfect match for the way CLI support is generated now from the builder API. Unfortunately, the library supports Java 8 and up, while Simple Java Mail is stuck at Java 7 (for good reasons).

Currently seeing if the library can be released for Java 7. Alternatively, I backport a fork to Java 7 and use that instead (if I can make the combination a success at all that is).

See dnault/therapi-runtime-javadoc#22.

To clarify why using this library would be a good idea: currently I'm maintaining dual documentation on each method: Javadoc and copied in annotations so I can use that documentation for the CLI --help displays. This library would allow me to maintain just the Javadoc.

@bbottema
Copy link
Owner Author

bbottema commented Oct 27, 2018

Dear diary,

I helped backport the therapi-runtime-javadoc to Java 1.7 and the maintainer (@dnault) accepted it, which is great. Also helped solve a few bugs regarding parsing Javadoc that I encountered when using the library.

Currently I'm on a snapshot again, until my last changes are incorporated. I have good faith that @dnault will merge and release in due time. I'm in no hurry though, since I'm still working on the CLI feature as a whole.

All in all looking pretty solid.

@bbottema
Copy link
Owner Author

bbottema commented Nov 24, 2018

CLI support is shaping up nicely, it's mostly done and all therapi-javadoc issues have been released properly as well. Now working on making CLI support an optional dependency, which is implemented moving to a modular project approach (#183).

bbottema referenced this issue in simple-java-mail/simplejavamail.org Dec 4, 2018
bbottema added a commit that referenced this issue Dec 22, 2018
…Includes all dependencies and helper scripts.
bbottema added a commit that referenced this issue Dec 23, 2018
bbottema added a commit that referenced this issue Dec 23, 2018
… with something like --email:startingBlank etc.
bbottema added a commit that referenced this issue Dec 27, 2018
@bbottema
Copy link
Owner Author

Cli support is done, documentation is done. Currently working on the last problem where ANSI color support isn't detected properly by Picocli (remkop/picocli#581).

bbottema added a commit that referenced this issue Dec 30, 2018
…n the library as we speak and will be released soon.
bbottema added a commit that referenced this issue Jan 9, 2019
@bbottema
Copy link
Owner Author

bbottema commented Jan 9, 2019

Finally, CLI support is finished! I'll finish the documentation and then move on 🎉

@bbottema bbottema closed this as completed Jan 9, 2019
bbottema added a commit that referenced this issue Jan 31, 2019
…ncy issues (#183),

- restructured all packages (#183),
- added support for CalendarMethod in CLI (#156),
- fixed JavaDoc for Maven multi-module project (#183)
- fixed all JavaDoc problems (#156)
@bbottema
Copy link
Owner Author

bbottema commented Dec 18, 2019

Finally released in 6.0.0-rc1!!

@bbottema
Copy link
Owner Author

6.0.0 has released as well, finally.

@remkop
Copy link

remkop commented Jan 24, 2020

Congrats! 🎆 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants