Skip to content

Commit

Permalink
[#884] Built-in picocli.AutoComplete.GenerateCompletion (`generate-…
Browse files Browse the repository at this point in the history
…completion`) subcommand should omit validation of mandatory options in the parent command.
  • Loading branch information
remkop committed Nov 27, 2019
1 parent 8b7f2a3 commit 7826db0
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 3 deletions.
33 changes: 33 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,38 @@
# picocli Release Notes


# <a name="4.1.2"></a> Picocli 4.1.2
The picocli community is pleased to announce picocli 4.1.2.

This release contains bugfixes, and documentation enhancements.



This is the sixty-fourth public release.
Picocli follows [semantic versioning](http://semver.org/).

## <a name="4.1.2-toc"></a> Table of Contents
* [New and noteworthy](#4.1.2-new)
* [Fixed issues](#4.1.2-fixes)
* [Deprecations](#4.1.2-deprecated)
* [Potential breaking changes](#4.1.2-breaking-changes)

## <a name="4.1.2-new"></a> New and Noteworthy



## <a name="4.1.2-fixes"></a> Fixed issues
[#884] (Bugfix) Built-in `picocli.AutoComplete.GenerateCompletion` (`generate-completion`) subcommand should omit validation of mandatory options in the parent command. Thanks to [Andreas Deininger](https://github.com/deining) for raising this.
[#883] (DOC) Update of Quick Guide . Thanks to [Andreas Deininger](https://github.com/deining) for the pull request.


## <a name="4.1.2-deprecated"></a> Deprecations
No features were deprecated in this release.

## <a name="4.1.2-breaking-changes"></a> Potential breaking changes
This release has no breaking changes.


# <a name="4.1.1"></a> Picocli 4.1.1
The picocli community is pleased to announce picocli 4.1.1.

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/picocli/AutoComplete.java
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@ private boolean checkExists(final File file) {
"",
"source <(${PARENT-COMMAND-NAME} ${COMMAND-NAME})",
""},
optionListHeading = "Options:%n"
optionListHeading = "Options:%n",
helpCommand = true
)
public static class GenerateCompletion implements Runnable {

Expand Down
10 changes: 8 additions & 2 deletions src/test/java/picocli/AutoCompleteTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1207,14 +1207,19 @@ public void testAddCandidatesForArgsFollowingNullPositionalParamAddsNoCandidates
@Command(name = "myapp", mixinStandardHelpOptions = true,
subcommands = AutoComplete.GenerateCompletion.class)
static class MyApp implements Runnable {

@Parameters(index = "0", description = "Required positional param")
String value;

public void run() { }
}

@Test
public void testGenerateCompletionParentUsageMessage() {
CommandLine cmd = new CommandLine(new MyApp());
String expected = String.format("" +
"Usage: myapp [-hV] [COMMAND]%n" +
"Usage: myapp [-hV] <value> [COMMAND]%n" +
" <value> Required positional param%n" +
" -h, --help Show this help message and exit.%n" +
" -V, --version Print version information and exit.%n" +
"Commands:%n" +
Expand All @@ -1228,7 +1233,8 @@ public void testGenerateCompletionCanBeHiddenFromParentUsageMessage() {
CommandLine gen = cmd.getSubcommands().get("generate-completion");
gen.getCommandSpec().usageMessage().hidden(true);
String expected = String.format("" +
"Usage: myapp [-hV] [COMMAND]%n" +
"Usage: myapp [-hV] <value> [COMMAND]%n" +
" <value> Required positional param%n" +
" -h, --help Show this help message and exit.%n" +
" -V, --version Print version information and exit.%n");
assertEquals(expected, cmd.getUsageMessage(CommandLine.Help.Ansi.OFF));
Expand Down

0 comments on commit 7826db0

Please sign in to comment.