Skip to content

Improve command aliasing #1167

Open
@fmbenhassine

Description

@fmbenhassine

As of v3.4, creating an alias for a command is done as follows:

CommandRegistration commandRegistration() {
	return CommandRegistration.builder()
		.command("mycommand")
		// define alias as myalias
		.withAlias()
			.command("myalias")
			.and()
		// define alias as myalias1 and myalias2
		.withAlias()
			.command("myalias1", "myalias2")
			.and()
		.build();
}

The DSL methods command("alias").and() are repetitive. I suggest to shorten them as follows:

CommandRegistration commandRegistration() {
	return CommandRegistration.builder()
		.command("mycommand")
		// define a single alias
		.withAlias("myalias")
		// or define multiple ones at once
		.withAlias("myalias1", "myalias2")
		.build();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions