Skip to content

Commit

Permalink
Show correct configured recipe name for CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
timtebeek committed Jan 15, 2024
1 parent 2c544b7 commit 821ab47
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/main/kotlin/org/openrewrite/RecipeMarkdownGenerator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1079,7 +1079,7 @@ class RecipeMarkdownGenerator : Runnable {
mavenPluginVersion,
suppressMaven,
suppressGradle,
getCliSnippet(recipeDescriptor),
getCliSnippet(exampleRecipeName),
)
} else {
writeSnippetsWithConfigurationWithoutDependency(
Expand All @@ -1088,7 +1088,7 @@ class RecipeMarkdownGenerator : Runnable {
mavenPluginVersion,
suppressMaven,
suppressGradle,
getCliSnippet(recipeDescriptor),
getCliSnippet(exampleRecipeName),
)
}
} else {
Expand All @@ -1099,7 +1099,7 @@ class RecipeMarkdownGenerator : Runnable {
mavenPluginVersion,
suppressMaven,
suppressGradle,
getCliSnippet(recipeDescriptor),
getCliSnippet(recipeDescriptor.name),
)
} else {
writeSnippetForOtherLibrary(
Expand All @@ -1109,7 +1109,7 @@ class RecipeMarkdownGenerator : Runnable {
mavenPluginVersion,
suppressMaven,
suppressGradle,
getCliSnippet(recipeDescriptor),
getCliSnippet(recipeDescriptor.name),
)
}
}
Expand Down Expand Up @@ -1242,13 +1242,13 @@ class RecipeMarkdownGenerator : Runnable {
}

private fun getCliSnippet(
recipeDescriptor: RecipeDescriptor,
name: String,
): String {
val lastPeriod = recipeDescriptor.name.lastIndexOf('.')
var trimmedRecipeName = recipeDescriptor.name
val lastPeriod = name.lastIndexOf('.')
var trimmedRecipeName = name

if (lastPeriod >= 0) {
trimmedRecipeName = recipeDescriptor.name.substring(lastPeriod + 1)
trimmedRecipeName = name.substring(lastPeriod + 1)
}

return """
Expand Down

0 comments on commit 821ab47

Please sign in to comment.