Skip to content

Commit

Permalink
Added --version
Browse files Browse the repository at this point in the history
  • Loading branch information
gtalarico committed May 7, 2018
1 parent f8206c9 commit 3f5eecc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ History

* Full Test Suite
* Fixed Envname character bug
* Added --version


0.4.1 (2018-05-02)
Expand Down
8 changes: 7 additions & 1 deletion pipenv_pipes/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import sys
import click

from . import __version__
from .environment import EnvVars
from .utils import get_query_matches, get_index_from_query
from .pipenv import (
Expand Down Expand Up @@ -37,8 +38,9 @@
is_flag=True,
help='Unlink Project Directory from this Environment')
@click.option('--verbose', '-v', is_flag=True, help='Verbose')
@click.option('--version', is_flag=True, help='Show Version')
@click.pass_context
def pipes(ctx, envname, list_, setlink, unlink, verbose):
def pipes(ctx, envname, list_, setlink, unlink, verbose, version):
"""
Pipes - PipEnv Environment Switcher
Expand All @@ -59,6 +61,10 @@ def pipes(ctx, envname, list_, setlink, unlink, verbose):
>>> pipes --list --verbose
"""
if version:
click.echo(__version__)
return

env_vars = EnvVars()
ensure_env_vars_are_ok(env_vars)
environments = find_environments(env_vars.PIPENV_HOME)
Expand Down
7 changes: 7 additions & 0 deletions tests/integration/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ def test_cli_help(runner):
assert 'show this message and exit' in help_result.output.lower()


def test_cli_version(runner):
from pipenv_pipes import __version__
result = runner.invoke(pipes, args=['--version'])
assert result.exit_code == 0
assert __version__ in result.output


def test_cli_from_shell():
import subprocess
result = subprocess.check_output(['pipes', '--help']).decode()
Expand Down

0 comments on commit 3f5eecc

Please sign in to comment.