You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/index.adoc
+13Lines changed: 13 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1927,6 +1927,19 @@ Custom type converters registered on a `CommandLine` instance will apply to all
1927
1927
1928
1928
Subcommands referenced in a `subcommands` attribute need to have a public no-argument constructor to be instantiated, unless a <<Custom Factory>> is installed to instantiate classes.
1929
1929
1930
+
=== Subcommand Aliases
1931
+
Commands may optionally define an `aliases` attribute to provide alternate names for commands that will be recognized by the parser. Aliases are displayed in the default help output. For example:
1932
+
[source,java]
1933
+
----
1934
+
@Command(name = "status", aliases = {"st"}, description = "Show the working tree status.")
1935
+
class GitStatus { ... }
1936
+
----
1937
+
1938
+
Would result in this help fragment:
1939
+
1940
+
----
1941
+
status, st Show the working tree status.
1942
+
----
1930
1943
=== Subcommands as Methods
1931
1944
From picocli 3.6 it is possible to register subcommands in a very compact manner by having a `@Command` class with `@Command`-annotated methods. The methods are automatically <<Subcommand Methods, registered as subcommands>> of the `@Command` class.
0 commit comments