-
Notifications
You must be signed in to change notification settings - Fork 418
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
Variable interpolation in defaultValue are not expanded in standard help #723
Comments
That sounds like a bug. Can you paste some example code to help me reproduce the issue? |
I've been able to reproduce the issue with this test: @Test
public void testIssue723() {
@Command(mixinStandardHelpOptions = false, showDefaultValues = true)
class Issue723 {
@Option(names="--mypath", defaultValue = "${sys:user.home}",
description = "Path. Default=${DEFAULT-VALUE}.")
private String path;
}
String expected = String.format("" +
"Usage: <main class> [--mypath=<path>]%n" +
" --mypath=<path> Path. Default=%1$s.%n" +
" Default: %1$s%n",
System.getProperty("user.home"));
String actual = new CommandLine(new Issue723()).getUsageMessage(CommandLine.Help.Ansi.OFF);
assertEquals(expected, actual);
} This currently prints:
If your issue is different, please let me know. I am investigating the above now. |
Fixed in master. Can you verify? |
Verified. Thanks for the quick turnaround and the good work on this project! |
Thanks for the verification. |
FYI, 4.0.0-beta-2 has been released. It may take a few hours for Maven mirrors to update. |
When using an option with defaultValue=${sys:user.home}, the field value is properly set. However, when using standard help options mixin, the help string mentions "Default: ${sys:user.home}" while I think it should display the interpolated value.
The text was updated successfully, but these errors were encountered: