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

[Enhancement] Support repeating command sequences #303

Closed
Pante opened this issue Aug 3, 2021 · 0 comments
Closed

[Enhancement] Support repeating command sequences #303

Pante opened this issue Aug 3, 2021 · 0 comments

Comments

@Pante
Copy link
Owner

Pante commented Aug 3, 2021

Is your feature request related to a problem? Please describe.
At present, adding a repeating sequence of command is more painful than necessary as it is not supported directly by Chimera. Developers wishing to add a repeating sequence need to manually iterate over each sequence and append it to the leaf of the previous sequence.

For example:

var builder = Argument.of("borderSize", IntegerArgumentType.integer(1)).then(Argument.of("borderShrinkTime", LongArgumentType.longArg(1)));
var command = builder.build();
var root = command;

for (var i = 0; i < 10; i++) {
  var child = builder.build();
  command.addChild(child);
  command = child;
}

This is both unwieldy since it needs to be manually re-coded for each repeating sequences and error-prone since iteratively adding sequences requires juggling multiple conditions and variables.

Describe the solution you'd like
We propose adding a repeating(int times) method to Literal and Argument, and their respective builders to facilitate adding repeating sequences.

Additional context
This issue was first raised by MrLn on Discord.

@Pante Pante changed the title [FEATURE REQUEST] Support repeating command sequences [Enhancement] Support repeating command sequences Aug 3, 2021
@Pante Pante closed this as completed Mar 12, 2023
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

1 participant