Skip to content

Releases: adamtomi/grapefruit

grapefruit-3.2.0

07 Jan 10:22
Compare
Choose a tag to compare

🟠 This version of grapefruit is stable finally, thus it's recommended to use it over version 1.x.0.

⚙️ CHANGELOG:

  • Rework completion system, made the completion API easier to use
  • Refactor argument mapper filters
  • Add listener system

grapefruit-3.1.0

23 Dec 19:59
ec7730f
Compare
Choose a tag to compare
grapefruit-3.1.0 Pre-release
Pre-release

🚧 This is an experimental release, proceed with caution! 🚧
Although grapefruit seems to be stable at this point and the number of currently known issues is also low, breaking changes still might be introduced in patch/minor versions.

⚙️ Changelog:

  • Added EnumArgumentMapper
  • Added more tests
  • Fixed auto-completion

📜 Note:
The enum argument mapper can be used to map string values into instances of any enum class. At the moment two modes are available:

  • Strict mode is case sensitive, and the completions contain all enum names unchanged
  • Lenient mode is case insensitive, and the completion list consists of all enum names in all lowercase

grapefruit-3.0.0

16 Dec 09:18
3eda232
Compare
Choose a tag to compare
grapefruit-3.0.0 Pre-release
Pre-release

🚧 Although this version seems to be stable, breaking changes may still occur. Such cases (if any) will be highlighted in the next release 🚧

The third version of grapefruit is a partial rewrite of the second version, which was a complete rewrite of the first version. The second version aimed to improve performance by relying on code generation via annotation processing as opposed to looking up and invoking methods via the Java reflection API, however the resulting library came with its own set of issues and thus was abandoned.

The third version changes the style of how commands are written. It employs a builder-like syntax as opposed to annotations. Although the amount of code to be written per command increased slightly, the overall complexity of the library decreased greatly resulting in a something, that's way easier to use compared to previous versions.

A simple echo command would look something like this:

public class EchoCommand implements CommandModule<Object> {
  private static final Key<String> MESSAGE_KEY = Key.named(String.class, "message");

  @Override
  public CommandChain<Object> chain(final CommandChainFactory<Object> factory) {
    return factory.newChain()
      .then(factory.literal("echo").build())
      .arguments()
      .then(factory.required(MESSAGE_KEY).mapWith(greedy()).build())
      .build();
  }

  @Override
  public void execute(final CommandContext<Object> context) {
    final String message = context.require(MESSAGE_KEY);
    System.out.println(message);
  }
}

grapefruit-2.0.0-ALPHA

16 Dec 08:51
c21dc20
Compare
Choose a tag to compare
Pre-release

🚧 This is an experimental version of grapefruit, that is no longer in active development. 🚧

The aim of this version was to completely get rid of the java reflection API, which grapefruit v1 heavily relied on. This was achieved using annotation processing to generate code. The library proved to be cumbersome to use.

grapefruit-1.5.0

02 Mar 09:32
d019de3
Compare
Choose a tag to compare

I do need another cup of coffee after this ☕

Apparently, isAnnotationPresent returns true only if the annotation is present exactly once, meaning that repeatable annotations are not compatible with this function. At least it seems that way.

Changelog ⚙️

  • Fixed AND conditions not working due to the issue described above

grapefruit-1.4.0

19 Jan 07:36
2110436
Compare
Choose a tag to compare

Just another grapefruit release 💣

It's been a while since the last release. Good news, it's perfectly stable at this point. This new version just adds a tiny quality of life update.

Changelog ⚙️

  • Made command syntax generation better
  • Also add CommandDispatcher#generateSyntax

grapefruit-1.3.0

20 Nov 09:46
Compare
Choose a tag to compare

Get ready for some grapefruit action! 🚀

Okay, seriously. Two weeks ago 1.1.0 was released which was supposed to be the last version of grapefruit for a while, but since, more and more ideas kept popping up. This weeks update brings a shiny new condition system to the table.

Changelog ⚙️

  • Introduced condition system. It lets you define conditions based on certain annotations which the current command context will be tested against upon command execution. Should a condition fail, the execution will be cancelled. Find out more

grapefruit-1.2.0

14 Nov 13:25
b75799e
Compare
Choose a tag to compare

Another day, another grapefruit release 🍊

This is just a small update, nothing major has changed.

Changelog ⚙️

  • Added the ability to register custom exception handlers, read more about them here
  • Command methods can now access the current context, more on that here
  • Removed ParameterMapper#suggestionsNeedValidation, since it wasn't used anymore (in fact, that function was never used really, should have been removed in 1.0.0)

grapefruit-1.1.0

07 Nov 10:09
Compare
Choose a tag to compare

The next release of Grapefruit is here 🎉

1.0.0 is a great example of why one has to do extensive testing before releasing stuff (especially, when it's marked as stable). On the surface level there were no issues with 1.0.0, however as we dug down deeper and started using all the available features, everything broke. 1.1.0 addresses every issue that I've encountered with the previous version, it even adds new and exciting stuff, but unfortunately this comes at a cost - countless breaking changes have been introduced, which I really wanted to avoid. Anyway, enjoy the new release! :)

Changelog ⚙️

  • Renamed resolvers to mappers, like this: NumberResolver -> NumberMapper. This also means, that everything that had resolve or resolver in their names have been remaned to map and mapper respectively
  • Added CharacterMapper, which makes it possible for commands to have parameters of type char
  • Replaced CommandResult with CommandContext, which contains a lot of usefuly functions (like querying parameter values by names or indexes). This might come in handy when a mapper depends on something that was mapped by a different mapper
  • ParameterMapper#map (which used to be ParameterResolver#resolve) now accepts a CommandContext instance as well
  • Renamed CommandArgument to CommandInput
  • Improved blank input handling thanks to the all new CommandInputTokenizer. Extra whitespace is turned into a blank argument like this: ['root', 'param0', ' ', 'param'], but only, if there are three of them between two arguments (because one is the normal delimiter, two means that two delimiters, three means a single space between two delimiters)
  • CommandParameter and ParameterNode classes have been merged into a new CommandParameter class, also a couple of new
    functions have been introduced, like CommandParameter#isFlag
  • Fixed quoted string mapping, which was utterly broken
  • Intoduced flag shorthands and made it possible to group flags using their shorthands (like: -abc Hello)
  • Replaced io.geantyref to Guava TypeTokens. This is a shame, but geantyref proved to be buggy (or I was an idiot; this could very well be the case)
  • Fail command registration, if a method is static. Static methods weren't allowed before, but they weren't check for either.
  • Add @Redirect annotation, read more about them here
  • Test all command names against the following regex: (\w|-)+. (Unicode characters are supported though)
  • Fixed @Regex pattern flags, they should work now
  • Made sure that parameter names (including flag names) and flag shorthands are unique to each specific parameter
  • Fixed suggestions. Seriously. That feature drove me crazy. But finally, it's doing what it was supposed to do all along
  • Added unit tests. Yeah, I've finnally done it! :)

That's all for now and hopefully for a good while.

grapefruit-1.0.0

14 Sep 11:27
Compare
Choose a tag to compare

Grapefruit is finally stable

Changelog:

  • Print exceptions thrown by listeners
  • Fixed message variables in NumberResolver