From 496a50a9995ba85c107e220a01b2a218a7267c6c Mon Sep 17 00:00:00 2001 From: Jon Bernard Date: Mon, 4 Jan 2016 05:37:06 -0500 Subject: Use click decorator for version option --- dotfiles.py | 9 +-------- setup.py | 3 +-- test_dotfiles.py | 6 ------ 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): -- cgit v1.2.3