diff options
author | Jon Bernard <jbernard@tuxion.com> | 2016-01-03 17:36:22 -0500 |
---|---|---|
committer | Jon Bernard <jbernard@tuxion.com> | 2016-01-03 22:39:43 -0500 |
commit | ad3e6a6d4456ffdf4c26deac7e06aa35d487f92e (patch) | |
tree | 7a02bda439088399d84794eba9d960e24b026e29 /dotfiles.py | |
parent | fce79366e1f1d48fd962dcb9d65a8ed4dc551643 (diff) | |
download | dotfiles-ad3e6a6d4456ffdf4c26deac7e06aa35d487f92e.tar.gz dotfiles-ad3e6a6d4456ffdf4c26deac7e06aa35d487f92e.tar.bz2 dotfiles-ad3e6a6d4456ffdf4c26deac7e06aa35d487f92e.zip |
Use test fixtures and some cleanup
Diffstat (limited to 'dotfiles.py')
-rw-r--r-- | dotfiles.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/dotfiles.py b/dotfiles.py index 1e087a1..f3bba1f 100644 --- a/dotfiles.py +++ b/dotfiles.py @@ -7,8 +7,8 @@ from operator import attrgetter __version__ = '0.7-dev' -default_home = os.path.expanduser('~/') -default_repo = os.path.expanduser('~/Dotfiles') +DEFAULT_HOME = os.path.expanduser('~/') +DEFAULT_REPO = os.path.expanduser('~/Dotfiles') def unique_suffix(path_a, path_b): @@ -127,9 +127,9 @@ pass_repo = click.make_pass_decorator(Repository) @click.group() -@click.option('--home-directory', type=click.Path(), default=str(default_home), +@click.option('--home-directory', type=click.Path(), default=DEFAULT_HOME, show_default=True) -@click.option('--repository', type=click.Path(), default=str(default_repo), +@click.option('--repository', type=click.Path(), default=DEFAULT_REPO, show_default=True) @click.pass_context def cli(ctx, home_directory, repository): @@ -155,6 +155,8 @@ def add(repo, files): def list(repo, verbose): """Show the contents of a repository.""" dotfiles = repo.contents() + if not dotfiles: + click.echo('[no dotfiles found]') for dotfile in dotfiles: if (verbose): click.echo('%-18s (%s)' % (dotfile, dotfile.state)) |