Repository: proteanhq/protean

Issue:
Implement a `--version` command to print current Protean version

Discussion:

Patch:
diff --git a/.bumpversion.cfg b/.bumpversion.cfg
index 8b196eae..f6a2b782 100644
--- a/.bumpversion.cfg
+++ b/.bumpversion.cfg
@@ -14,4 +14,3 @@ replace = version = release = '{new_version}'
 [bumpversion:file:src/protean/__init__.py]
 search = __version__ = '{current_version}'
 replace = __version__ = '{new_version}'
-
diff --git a/src/protean/cli.py b/src/protean/cli.py
index 3a7bbcdf..8947e526 100644
--- a/src/protean/cli.py
+++ b/src/protean/cli.py
@@ -17,14 +17,20 @@ Why does this file exist, and why not put this in __main__?
 import click
 
 
-@click.group()
-def main():
-    """ CLI utilities for the protean package """
-    pass
+@click.group(invoke_without_command=True)
+@click.version_option()
+@click.pass_context
+def main(ctx):
+    """CLI utilities for the Protean"""
+    if ctx.invoked_subcommand is None:
+        click.echo(ctx.get_help())
 
 
 @main.command()
-@click.argument('names', nargs=-1)
-def echo(names):
-    """Simply print input argument `names`"""
-    click.echo(repr(names))
+def test():
+    import pytest
+    import sys
+
+    errno = pytest.main(['-v', '--flake8'])
+
+    sys.exit(errno)


Test patch:
diff --git a/tests/core/test_entity.py b/tests/core/test_entity.py
index 00f5fd25..5f800984 100644
--- a/tests/core/test_entity.py
+++ b/tests/core/test_entity.py
@@ -640,7 +640,7 @@ class TestEntity:
         dog4 = Dog.create(name='d\"Artagnan4', owner='John', age=5)
 
         assert all(dog is not None for dog in [dog1, dog2, dog3, dog4])
-    
+
     def test_override(self):
         """Test overriding methods from Entity"""
         class ImmortalDog(Entity):
diff --git a/tests/test_protean.py b/tests/test_protean.py
index e73641e6..7904ebcd 100644
--- a/tests/test_protean.py
+++ b/tests/test_protean.py
@@ -6,7 +6,9 @@ from protean.cli import main
 
 def test_main():
     runner = CliRunner()
-    result = runner.invoke(main, ['echo'])
+    result = runner.invoke(main, ['--version'])
 
-    assert result.output == '()\n'
+    from protean import __version__
+
+    assert result.output == 'main, version {protean_version}\n'.format(protean_version=__version__)
     assert result.exit_code == 0