Skip to content

Commit 234fa16

Browse files
committed
Add version command
1 parent 383496c commit 234fa16

File tree

4 files changed

+21
-7
lines changed

4 files changed

+21
-7
lines changed

runbook/cli/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import click
44

5-
from runbook.cli.commands import create, edit, export, init, plan, review, run
5+
from runbook.cli.commands import create, edit, export, init, plan, review, run, version
66

77
# TODO: not working, needs a custom underlying class to handle the auto-env
88
CONTEXT_SETTINGS = dict(auto_envvar_prefix="RUNBOOK")
@@ -29,6 +29,7 @@ def cli(ctx, cwd):
2929
cli.add_command(create)
3030
cli.add_command(run)
3131
cli.add_command(review)
32+
cli.add_command(version)
3233
# cli.add_command(export)
3334
cli.name = "runbook"
3435
cli

runbook/cli/commands/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
from runbook.cli.commands.plan import plan
55
from runbook.cli.commands.review import review
66
from runbook.cli.commands.run import run
7+
from runbook.cli.commands.version import version

runbook/cli/commands/version.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import click
2+
3+
from runbook import __version__ as VERSION
4+
5+
6+
@click.command()
7+
@click.pass_context
8+
def version(ctx):
9+
"""Display version information about runbook"""
10+
11+
click.echo(f"Runbook version: {VERSION}")

tests/cli_test.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,13 @@ def test_cli_help():
2727
--help Show this message and exit.
2828
2929
Commands:
30-
create Create a new runbook from [template]
31-
edit Edit an existing runbook
32-
init Initialize a folder as a runbook repository
33-
plan Prepares the runbook for execution by injecting parameters.
34-
review [Unimplemented] Entrypoint for reviewing runbook
35-
run Run a notebook
30+
create Create a new runbook from [template]
31+
edit Edit an existing runbook
32+
init Initialize a folder as a runbook repository
33+
plan Prepares the runbook for execution by injecting parameters.
34+
review [Unimplemented] Entrypoint for reviewing runbook
35+
run Run a notebook
36+
version Display version information about runbook
3637
"""
3738
assert result.output == output
3839

0 commit comments

Comments
 (0)