Skip to content

Commit 9170a9e

Browse files
committed
refactor: version as flag
1 parent 4e4765f commit 9170a9e

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/aw_nextblock/cli.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,17 @@
1818
@click.pass_context
1919
@click.option('--testing', is_flag=True, help='Enable testing mode for the watcher')
2020
@click.option('--verbose', is_flag=True, help='Enable verbose logging for the watcher')
21-
def cli(ctx, testing, verbose):
21+
@click.option('--version', is_flag=True, help='Show version information')
22+
def cli(ctx, testing, verbose, version):
2223
"""aw-nextblock: Flexible time blocking for ActivityWatch
2324
2425
Run without commands to start the watcher process.
2526
Use commands for session management.
2627
"""
28+
if version:
29+
click.echo(f"aw-nextblock v{__version__}")
30+
ctx.exit()
31+
2732
ctx.obj = {
2833
'testing': testing,
2934
'verbose': verbose
@@ -125,13 +130,7 @@ def stop():
125130
click.echo("No active session found", err=True)
126131
sys.exit(1)
127132

128-
@click.command()
129-
def version():
130-
"""Show version information"""
131-
click.echo(f"aw-nextblock v{__version__}")
132-
133133
cli.add_command(start)
134134
cli.add_command(next)
135135
cli.add_command(status)
136136
cli.add_command(stop)
137-
cli.add_command(version)

0 commit comments

Comments
 (0)