Skip to content

Commit 97049c2

Browse files
committed
Add version subcommand
1 parent 832ff64 commit 97049c2

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/blurb/blurb.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,15 @@ def get_subcommand(subcommand):
742742

743743

744744

745+
@subcommand
746+
def version():
747+
"""
748+
Print blurb version.
749+
"""
750+
print("blurb version", __version__)
751+
752+
753+
745754
@subcommand
746755
def help(subcommand=None):
747756
"""
@@ -818,6 +827,8 @@ def help(subcommand=None):
818827

819828
# Make "blurb --help" work.
820829
subcommands["--help"] = help
830+
subcommands["--version"] = version
831+
subcommands["-v"] = version
821832

822833

823834
@subcommand
@@ -1205,7 +1216,7 @@ def main():
12051216
fn = get_subcommand(subcommand)
12061217

12071218
# hack
1208-
if fn in (test, help):
1219+
if fn in (help, test, version):
12091220
sys.exit(fn(*args))
12101221

12111222
try:

tox.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,7 @@ commands =
1919
{posargs}
2020
blurb test
2121
blurb help
22+
blurb --version
2223
{envpython} -I -m blurb test
2324
{envpython} -I -m blurb help
25+
{envpython} -I -m blurb version

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy