Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tsoc
hg-misc-tools
Commits
b020b8d8
Commit
b020b8d8
authored
Mar 07, 2026
by
one
Browse files
[xcl-lens] Add --version
parent
80b9c37f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
1 deletion
+21
-1
projects/xcl-lens/src/xcl_lens/main.py
projects/xcl-lens/src/xcl_lens/main.py
+21
-1
No files found.
projects/xcl-lens/src/xcl_lens/main.py
View file @
b020b8d8
...
@@ -5,6 +5,7 @@ from typing import Annotated
...
@@ -5,6 +5,7 @@ from typing import Annotated
import
typer
import
typer
from
.
import
__version__
from
.runner
import
run_with_input
from
.runner
import
run_with_input
from
.utils
import
get_mpi_rank
from
.utils
import
get_mpi_rank
...
@@ -20,6 +21,12 @@ app = typer.Typer(
...
@@ -20,6 +21,12 @@ app = typer.Typer(
)
)
def
_version_callback
(
value
:
bool
):
if
value
:
typer
.
echo
(
f
"xcl-lens
{
__version__
}
"
)
raise
typer
.
Exit
()
@
app
.
command
(
@
app
.
command
(
context_settings
=
{
context_settings
=
{
"allow_extra_args"
:
True
,
"allow_extra_args"
:
True
,
...
@@ -29,7 +36,20 @@ app = typer.Typer(
...
@@ -29,7 +36,20 @@ app = typer.Typer(
)
)
def
main
(
def
main
(
ctx
:
typer
.
Context
,
ctx
:
typer
.
Context
,
summary
:
Annotated
[
bool
,
typer
.
Option
(
help
=
"Print summary report only"
)]
=
False
,
version
:
Annotated
[
bool
,
typer
.
Option
(
"--version"
,
help
=
"Show version and exit"
,
is_flag
=
True
,
is_eager
=
True
,
callback
=
_version_callback
,
),
]
=
False
,
summary
:
Annotated
[
bool
,
typer
.
Option
(
"-s"
,
"--summary"
,
help
=
"Print summary report only"
),
]
=
False
,
verbose
:
Annotated
[
bool
,
typer
.
Option
(
"-v"
,
"--verbose"
,
help
=
"Print verbose reports"
)]
=
False
,
verbose
:
Annotated
[
bool
,
typer
.
Option
(
"-v"
,
"--verbose"
,
help
=
"Print verbose reports"
)]
=
False
,
hosts
:
Annotated
[
str
|
None
,
typer
.
Option
(
help
=
"Filter by hosts (comma-separated)"
)]
=
None
,
hosts
:
Annotated
[
str
|
None
,
typer
.
Option
(
help
=
"Filter by hosts (comma-separated)"
)]
=
None
,
ranks
:
Annotated
[
str
|
None
,
typer
.
Option
(
help
=
"Filter by ranks (comma-separated)"
)]
=
None
,
ranks
:
Annotated
[
str
|
None
,
typer
.
Option
(
help
=
"Filter by ranks (comma-separated)"
)]
=
None
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment