Skip to content

Support for (global) configuration of printer features #18

Description

@Strokkur424

Is your feature request related to a problem?

Currently, there are a few hard-coded things:

  1. The generated file names are always appended with Brigadier
  2. The indent is always 4 spaces.
  3. Argument names are always 1:1 the same as parameter names.

This (mainly the third issue) can leave some frustrations to users who want more control over the AP.

Describe the solution you'd like.

The issue can be solved with the introduction of two new annotations:

  • @DefaultCommandsConfig
  • @CommandsConfig

The @DefaultCommandsConfig annotation allows setting global-defaults, which are applied to all commands.
Configurations can be overridden on a per-class basis using the @CommandsConfig annotation, which would be applied to the source file.

The default one would only be allowed to exist once per project to avoid any unexpected behaviour.

An example configuration might look like this:

@DefaultCommandsConfig(
  indent = "\s\s", // two space indent
  names = @PrependGeneratedFile("C"), // a source file named "MyCommand" generated a file "CMyCommand"
  parameterMappings = ParameterMappings.KEBAB_CASE // "someParameter" turns into "some-parameter" in the Brigadier tree
)
public class MyJavaPlugin extends JavaPlugin {
  // plugin logic
}

Describe alternatives you've considered.

No response

Other

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions