Skip to content

Commit

Permalink
[#2028][#2031] Add setter for name in `picocli.shell.jline3.PicocliCo…
Browse files Browse the repository at this point in the history
…mmands`
  • Loading branch information
remkop committed Jun 3, 2023
1 parent 0bebcc5 commit b42fb05
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
3 changes: 3 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@ Artifacts in this release are signed by Remko Popma (6601 E5C0 8DCC BB96).

See fixed items below.

I cheated on the semantic versioning in this release: a public setter method was added in a class in the `picocli.shell.jline3` module. In spite of that, the version number went from 4.7.3 to 4.7.4 (not 4.8.0). My apologies.


## <a name="4.7.4-fixes"></a> Fixed issues
* [#2028][#2031] API: Add setter for name in `picocli.shell.jline3.PicocliCommands`. Thanks to [Irina Leontyuk](https://github.com/irinaleo) for raising this.
* [#2026][#2027] Enhancement: Improved feedback on mistyped subcommands. Thanks to [David Pond](https://github.com/mauvo) for the pull request.
* [#2029][#2034] Enhancement: prevent `java.nio.charset.UnsupportedCharsetException: cp0` on windows, and fall back to the default charset if the charset provided by System property `sun.stdout.encoding` is invalid. Thanks to [
Bartosz Spyrko-Smietanko](https://github.com/spyrkob) for the pull request.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
* @since 4.1.2
*/
public class PicocliCommands implements CommandRegistry {
private String picocliCommandsName;

/**
* Command that clears the screen.
Expand Down Expand Up @@ -307,4 +308,25 @@ public Map<String, String> commandAliases() {
public CmdDesc commandDescription(String command) {
return null;
}

/**
* Returns the name shown for this collection of picocli commands in the usage help message.
* If not set with {@link #name(String)}, this returns {@link CommandRegistry#name()}.
* @return the name shown for this collection of picocli commands in the usage help message
*/
@Override
public String name() {
if (picocliCommandsName != null) {
return picocliCommandsName;
}
return CommandRegistry.super.name();
}

/**
* Sets the name shown for this collection of picocli commands in the usage help message.
* @param newName the new name to show
*/
public void name(String newName) {
picocliCommandsName = newName;
}
}

0 comments on commit b42fb05

Please sign in to comment.