From 821ab474934d72d21a5ec5b956ea92b2c155759f Mon Sep 17 00:00:00 2001 From: Tim te Beek Date: Mon, 15 Jan 2024 11:19:54 +0100 Subject: [PATCH] Show correct configured recipe name for CLI --- .../org/openrewrite/RecipeMarkdownGenerator.kt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/kotlin/org/openrewrite/RecipeMarkdownGenerator.kt b/src/main/kotlin/org/openrewrite/RecipeMarkdownGenerator.kt index a37d7a1..14d8ed0 100644 --- a/src/main/kotlin/org/openrewrite/RecipeMarkdownGenerator.kt +++ b/src/main/kotlin/org/openrewrite/RecipeMarkdownGenerator.kt @@ -1079,7 +1079,7 @@ class RecipeMarkdownGenerator : Runnable { mavenPluginVersion, suppressMaven, suppressGradle, - getCliSnippet(recipeDescriptor), + getCliSnippet(exampleRecipeName), ) } else { writeSnippetsWithConfigurationWithoutDependency( @@ -1088,7 +1088,7 @@ class RecipeMarkdownGenerator : Runnable { mavenPluginVersion, suppressMaven, suppressGradle, - getCliSnippet(recipeDescriptor), + getCliSnippet(exampleRecipeName), ) } } else { @@ -1099,7 +1099,7 @@ class RecipeMarkdownGenerator : Runnable { mavenPluginVersion, suppressMaven, suppressGradle, - getCliSnippet(recipeDescriptor), + getCliSnippet(recipeDescriptor.name), ) } else { writeSnippetForOtherLibrary( @@ -1109,7 +1109,7 @@ class RecipeMarkdownGenerator : Runnable { mavenPluginVersion, suppressMaven, suppressGradle, - getCliSnippet(recipeDescriptor), + getCliSnippet(recipeDescriptor.name), ) } } @@ -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 """