Skip to content

Commit

Permalink
Add version subcommand
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Oct 11, 2024
1 parent 832ff64 commit 97049c2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/blurb/blurb.py
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,15 @@ def get_subcommand(subcommand):



@subcommand
def version():
"""
Print blurb version.
"""
print("blurb version", __version__)

Check warning on line 750 in src/blurb/blurb.py

View check run for this annotation

Codecov / codecov/patch

src/blurb/blurb.py#L750

Added line #L750 was not covered by tests



@subcommand
def help(subcommand=None):
"""
Expand Down Expand Up @@ -818,6 +827,8 @@ def help(subcommand=None):

# Make "blurb --help" work.
subcommands["--help"] = help
subcommands["--version"] = version
subcommands["-v"] = version


@subcommand
Expand Down Expand Up @@ -1205,7 +1216,7 @@ def main():
fn = get_subcommand(subcommand)

# hack
if fn in (test, help):
if fn in (help, test, version):
sys.exit(fn(*args))

try:
Expand Down
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,7 @@ commands =
{posargs}
blurb test
blurb help
blurb --version
{envpython} -I -m blurb test
{envpython} -I -m blurb help
{envpython} -I -m blurb version

0 comments on commit 97049c2

Please sign in to comment.