Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add version subcommand #29

Merged
merged 3 commits into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/blurb/blurb.py
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,13 @@



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

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

View check run for this annotation

Codecov / codecov/patch

src/blurb/blurb.py#L748

Added line #L748 was not covered by tests



@subcommand
def help(subcommand=None):
"""
Expand Down Expand Up @@ -816,8 +823,10 @@
print(doc)
sys.exit(0)

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


@subcommand
Expand Down Expand Up @@ -1205,7 +1214,7 @@
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