From a35846aa54467c090e9d837ca7dda8631e7055da Mon Sep 17 00:00:00 2001 From: Ashutoshy115 Date: Mon, 4 May 2026 02:57:03 +0100 Subject: [PATCH 1/2] feat(command): show example values for parameters in help command --- .../infrastructure/primary/ApplyModuleSubCommand.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/seed4j/cli/command/infrastructure/primary/ApplyModuleSubCommand.java b/src/main/java/com/seed4j/cli/command/infrastructure/primary/ApplyModuleSubCommand.java index 1bba40c6..8982df69 100644 --- a/src/main/java/com/seed4j/cli/command/infrastructure/primary/ApplyModuleSubCommand.java +++ b/src/main/java/com/seed4j/cli/command/infrastructure/primary/ApplyModuleSubCommand.java @@ -96,8 +96,9 @@ private void addOptions(CommandSpec spec, Seed4JModulePropertiesDefinition prope spec.addOption( OptionSpec.builder(toDashedFormat(property.key())) .description( - "%s%s".formatted( + "%s%s%s".formatted( property.description().map(Seed4JPropertyDescription::get).orElse(""), + exampleValues(property), property.isMandatory() ? " (required)" : "" ) ) @@ -113,6 +114,14 @@ private List completionCandidates(Seed4JModulePropertyDefinition propert return knownCompletionCandidates.candidates(property); } + private String exampleValues(Seed4JModulePropertyDefinition property) { + List candidates = knownCompletionCandidates.candidates(property); + if (candidates.isEmpty()) { + return ""; + } + return " e.g. " + String.join(", ", candidates); + } + @ExcludeFromGeneratedCodeCoverage(reason = "There is no Seed4J module using a property with the BOOLEAN type") private static Class toOptionType(Seed4JPropertyType type) { return switch (type) { From ecc3550d284b8f366e91cfcc62d431f8bc5bd1af Mon Sep 17 00:00:00 2001 From: Ashutoshy115 Date: Sun, 5 Jul 2026 00:23:34 +0100 Subject: [PATCH 2/2] fix(command): show all completion candidates in help descriptions --- .../primary/Seed4JCommandsFactoryTest.java | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/test/java/com/seed4j/cli/command/infrastructure/primary/Seed4JCommandsFactoryTest.java b/src/test/java/com/seed4j/cli/command/infrastructure/primary/Seed4JCommandsFactoryTest.java index 06d20070..83a3ff4e 100644 --- a/src/test/java/com/seed4j/cli/command/infrastructure/primary/Seed4JCommandsFactoryTest.java +++ b/src/test/java/com/seed4j/cli/command/infrastructure/primary/Seed4JCommandsFactoryTest.java @@ -516,8 +516,25 @@ void shouldNotApplyInitModuleMissingRequiredOptions(CapturedOutput output) throw .contains("Missing required") .contains("'--base-name='") .contains("'--project-name='") - .contains("Project short name (only letters and numbers) (required)") - .contains("Project full name (required)"); + .contains("Project short name (only letters and numbers) e.g.") + .contains("seed4jSampleApplication (required)") + .contains("Project full name e.g. Seed4J Sample Application") + .contains("(required)"); + } + + @Test + void shouldShowExampleValuesInHelpDescription(CapturedOutput output) { + String[] args = { "apply", "init", "--help" }; + + int exitCode = commandLine(modules, projects).execute(args); + + assertThat(exitCode).isZero(); + assertThat(output) + .contains("Project short name (only letters and numbers) e.g.") + .contains("seed4jSampleApplication (required)") + .contains("Node package manager e.g. npm, pnpm (required)") + .contains("Project full name e.g. Seed4J Sample Application") + .contains("(required)"); } @Test