Support serena --version CLI command

Resolves #1347
This commit is contained in:
Dominik Jain authored and Dominik Jain committed 2026-04-15 00:01:24 +02:00
1 parent d6ea5bffde
commit 7067963d6e
2 files changed
+23

No files matched your search

+3
View File
@@ -2,6 +2,9 @@
Status of the `main` branch. Changes prior to the next official version change will appear here.
* General:
- Support `serena --version` CLI command for displaying the current version #1347
# v1.1.2 (2026-04-14)
* General:
+20
View File
@@ -139,6 +139,26 @@ class TopLevelCommands(AutoRegisteringGroup):
"that separate entrypoint for performance reasons, see `serena-hooks --help`. You can run `<command> --help` for more info on each command.",
)
# register --version / -V flag
self.params.append(
click.Option(
["--version", "-V"],
is_flag=True,
expose_value=False,
is_eager=True,
callback=self._print_version,
help="Show the version and exit.",
)
)
@staticmethod
def _print_version(ctx: click.Context, _param: click.Parameter, value: bool) -> None:
"""Print version string and exit if the flag is set."""
if not value:
return
click.echo(f"Serena {serena_version()}")
ctx.exit()
@staticmethod
@click.command(
"init",