Skip to content

Commit cfe421c

Browse files
committed
version argument change to is_eager.
1 parent 8ae0163 commit cfe421c

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

src/wristpy/core/cli.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@ class NonwearAlgorithms(str, Enum):
5454
detach = "detach"
5555

5656

57+
def version_callback(version: bool):
58+
"""Check the version independently."""
59+
if version:
60+
typer.echo(f"Wristpy version: {config.get_version()}")
61+
raise typer.Exit()
62+
63+
5764
@app.command()
5865
def main(
5966
input: pathlib.Path = typer.Argument(
@@ -122,18 +129,20 @@ def main(
122129
help="Determines the level of verbosity. Use -v for info, -vv for debug. "
123130
"If -vvv or more, it will be set to debug. "
124131
"Default for warning.",
132+
callback=version_callback,
125133
),
126134
version: bool = typer.Option(
127-
False, "-V", "--version", help="Show the version and exit."
135+
False,
136+
"-V",
137+
"--version",
138+
help="Show the version and exit.",
139+
callback=version_callback,
140+
is_eager=True,
128141
),
129142
) -> None:
130143
"""Run wristpy orchestrator with command line arguments."""
131144
from wristpy.core import orchestrator
132145

133-
if version:
134-
typer.echo(f"Wristpy version: {config.get_version()}")
135-
raise typer.Exit()
136-
137146
if verbosity == 0:
138147
log_level = logging.WARNING
139148
elif verbosity == 1:

0 commit comments

Comments
 (0)