Support both kebab-case and camelCase as Spring init CLI Options#28138
Support both kebab-case and camelCase as Spring init CLI Options#28138vignesh1992 wants to merge 4 commits intospring-projects:mainfrom
Conversation
snicoll
left a comment
There was a problem hiding this comment.
Thanks for the PR but this adresses only a small part of the original issue. In particular, the issue was about showing consistent options in the CLI:
The code has a mapping from CLI options (kebab-case) to query parameters (camelCase) when issuing a project creation request. I think it needs to map things the other way when displaying information for init --help
The other part was to use kebab case consistently:
We should probably also fix the CLI options so that all multi-word options have a kebab-case variant. Specifically --artifactId and --groupId should be joined by --artifact-id and --group-id respectively. The camelCase variants of the CLI options should be deprecated.
If you intend to only provide a fix for the second part, please let us know and we can then reopen the other issue.
| this.name = option(Arrays.asList("name", "n"), "Project name; infer application name").withRequiredArg(); | ||
| this.description = option("description", "Project description").withRequiredArg(); | ||
| this.packageName = option("package-name", "Package name").withRequiredArg(); | ||
| this.packageName = option(Arrays.asList("packageName", "package-name"), "Package name").withRequiredArg(); |
There was a problem hiding this comment.
The plan is to use kebab case consistently, not introducing a mixed case for new properties.
There was a problem hiding this comment.
I thought we were going to support both camelCase and kebab-case until we've improved the output of spring init --list so that it converts the server's output from the camelCase that it expects to the kebab-case that the CLI prefers. That improvement to spring init --list was to be handled separately.
There was a problem hiding this comment.
Ah ok, right. I understand now. Yes, so we should have to consistent indeed but we need to deprecate them.
| + "'project' for a project archive)").withRequiredArg().defaultsTo("project"); | ||
| this.javaVersion = option(Arrays.asList("java-version", "j"), "Language level (for example '1.8')") | ||
| .withRequiredArg(); | ||
| this.javaVersion = option(Arrays.asList("javaVersion", "java-version", "j"), |
There was a problem hiding this comment.
The plan is to use kebab case consistently, not introducing a mixed case for new properties.
| this.language = option(Arrays.asList("language", "l"), "Programming language (for example 'java')") | ||
| .withRequiredArg(); | ||
| this.bootVersion = option(Arrays.asList("boot-version", "b"), | ||
| this.bootVersion = option(Arrays.asList("bootVersion", "boot-version", "b"), |
There was a problem hiding this comment.
The plan is to use kebab case consistently, not introducing a mixed case for new properties.
| this.groupId = option(Arrays.asList("groupId", "g"), "Project coordinates (for example 'org.test')") | ||
| .withRequiredArg(); | ||
| this.artifactId = option(Arrays.asList("artifactId", "a"), | ||
| this.groupId = option(Arrays.asList("groupId", "group-id", "g"), |
| this.artifactId = option(Arrays.asList("artifactId", "a"), | ||
| this.groupId = option(Arrays.asList("groupId", "group-id", "g"), | ||
| "Project coordinates (for example 'org.test')").withRequiredArg(); | ||
| this.artifactId = option(Arrays.asList("artifactId", "artifact-id", "a"), |
|
@vignesh1992 please ignore my comment about the table. I forgot this is something that should be addressed elsewhere. |
|
Hi @snicoll, Thank you so much for your feedback! Should there be any change which I have to perform or is this PR good to go? |
Update `InitCommand` to support both camelCase and kebab-case. See gh-28138
…ons' Refine the command so that camelCase options are supported but not advertised. See gh-28138
|
Thanks very much @vignesh1992, this has now been merged to |
Closes spring-projectsgh-28138 (cherry picked from commit 7aed627)
Spring init CLI to support both kebab-case and camelCase as project generation options. This PR addresses the issue #26878