-
Notifications
You must be signed in to change notification settings - Fork 41k
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
Support both kebab-case and camelCase as Spring init CLI Options #28138
Support both kebab-case and camelCase as Spring init CLI Options #28138
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
"Project coordinates; infer archive name (for example 'test')").withRequiredArg(); | ||
this.version = option(Arrays.asList("version", "v"), "Project version (for example '0.0.1-SNAPSHOT')") | ||
.withRequiredArg(); | ||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The plan is to use kebab case consistently, not introducing a mixed case for new properties.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ok, right. I understand now. Yes, so we should have to consistent indeed but we need to deprecate them.
@@ -148,11 +153,11 @@ private void projectGenerationOptions() { | |||
.defaultsTo("maven"); | |||
this.format = option("format", "Format of the generated content (for example 'build' for a build file, " | |||
+ "'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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
groupId
is not deprecated.
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"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
artifactId
is not deprecated.
@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