aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Jon Bernard <jbernard@tuxion.com> 2016-01-04 05:37:06 -0500
committerGravatar Jon Bernard <jbernard@tuxion.com> 2016-01-04 05:39:19 -0500
commit496a50a9995ba85c107e220a01b2a218a7267c6c (patch)
tree962d13becda341c2a667d4da0aef6bd888f03314
parentf216646d2e824af726a7cd0d4d881577ea6dd0d8 (diff)
downloaddotfiles-496a50a9995ba85c107e220a01b2a218a7267c6c.tar.gz
dotfiles-496a50a9995ba85c107e220a01b2a218a7267c6c.tar.bz2
dotfiles-496a50a9995ba85c107e220a01b2a218a7267c6c.zip
Use click decorator for version option
-rw-r--r--dotfiles.py9
-rw-r--r--setup.py3
-rw-r--r--test_dotfiles.py6
3 files changed, 2 insertions, 16 deletions
diff --git a/dotfiles.py b/dotfiles.py
index ce0d31a..9a7fe9a 100644
--- a/dotfiles.py
+++ b/dotfiles.py
@@ -5,8 +5,6 @@ import errno
from operator import attrgetter
-__version__ = '0.7-dev'
-
DEFAULT_HOME = os.path.expanduser('~/')
DEFAULT_REPO = os.path.expanduser('~/Dotfiles')
@@ -131,6 +129,7 @@ pass_repo = click.make_pass_decorator(Repository)
show_default=True)
@click.option('--repository', type=click.Path(), default=DEFAULT_REPO,
show_default=True)
+@click.version_option()
@click.pass_context
def cli(ctx, home_directory, repository):
"""Dotfiles is a tool to make managing your dotfile symlinks in $HOME easy,
@@ -220,9 +219,3 @@ def unsync(repo, files):
"""TODO"""
for filename in files:
repo.unsync(filename)
-
-
-@cli.command()
-def version():
- """Show the version number."""
- click.echo("dotfiles version %s" % __version__)
diff --git a/setup.py b/setup.py
index 9d79bbd..8df4968 100644
--- a/setup.py
+++ b/setup.py
@@ -1,10 +1,9 @@
from setuptools import setup
-from dotfiles import __version__
setup(
name='dotfiles',
- version=__version__,
+ version='0.7-dev',
author='Jon Bernard',
author_email='jbernard@tuxion.com',
description='Easily manage your dotfiles',
diff --git a/test_dotfiles.py b/test_dotfiles.py
index 371b66e..db63632 100644
--- a/test_dotfiles.py
+++ b/test_dotfiles.py
@@ -1,7 +1,6 @@
import py
import pytest
-from dotfiles import __version__
from dotfiles import cli, unique_suffix
from dotfiles import Repository, Dotfile
@@ -60,11 +59,6 @@ class TestCli(object):
def test_staus(self):
pass
- def test_version(self, runner):
- result = runner.invoke(cli, ['version'])
- assert not result.exception
- assert result.output == 'dotfiles version %s\n' % __version__
-
class TestRepository(object):