✨ gh --version
2 files changed, 17 insertions(+), 1 deletions(-)

M lairucrem/__init__.py
M lairucrem/__main__.py
M lairucrem/__init__.py +6 -0
@@ 9,12 9,18 @@ import contextlib
 import imp
 
 import urwid
+from pkg_resources import DistributionNotFound, get_distribution
 
 from . import config
 
 __all__ = [
     'get_extension_path', 'get_main_loop', 'interrupt_mainloop', 'open_popup']
 
+try:
+    __version__ = get_distribution(__name__).version
+except DistributionNotFound:
+    __version__ = 'From sources!'
+
 
 _MAIN_LOOP = None
 

          
M lairucrem/__main__.py +11 -1
@@ 2,10 2,11 @@ import asyncio
 import itertools
 import logging.config
 import os
+import sys
 from pathlib import Path
 
 from . import (
-    commands, config, controler, get_main_loop, process,
+    __version__, commands, config, controler, get_main_loop, process,
     set_main_widget_policy, utils)
 
 #

          
@@ 134,6 135,8 @@ def parse_args():
     parser.add_argument('--disable-inotify', default=False, action='store_true',
                         help='disable automatic refresh data on repository modification.'
                         'Requires aionotify (https://github.com/rbarrois/aionotify)')
+    parser.add_argument('--version', action='store_true',
+                        help='show version')
     return parser.parse_args()
 
 

          
@@ 195,8 198,15 @@ def force_ascii_decoration():
     config.BORDERS = config.BORDERS_ASCII
 
 
+def show_version_and_exit():
+    print(__version__)
+    sys.exit(0)
+
+
 def main():
     opts = parse_args()
+    if opts.version:
+        show_version_and_exit()
     setup_logging(opts.log_path)
     config.DEBUG = opts.debug
     if opts.with_hg is not None: