aboutsummaryrefslogtreecommitdiffstats
path: root/dotfiles.py
diff options
context:
space:
mode:
authorGravatar Jon Bernard <jbernard@tuxion.com> 2016-01-15 16:09:31 -0500
committerGravatar Jon Bernard <jbernard@tuxion.com> 2016-01-15 16:09:31 -0500
commitd82db52d14a26244635843364b7dc15c8c102da7 (patch)
tree9e5dc475373f81b920ac715e06c1341882b2a08f /dotfiles.py
parent1bdceb351b50b805262978bc6cb2e0e0dbcdb089 (diff)
downloaddotfiles-d82db52d14a26244635843364b7dc15c8c102da7.tar.gz
dotfiles-d82db52d14a26244635843364b7dc15c8c102da7.tar.bz2
dotfiles-d82db52d14a26244635843364b7dc15c8c102da7.zip
Show confirmation on stdout for each successful operation
Diffstat (limited to 'dotfiles.py')
-rw-r--r--dotfiles.py23
1 files changed, 19 insertions, 4 deletions
diff --git a/dotfiles.py b/dotfiles.py
index c8b362c..efc4d41 100644
--- a/dotfiles.py
+++ b/dotfiles.py
@@ -123,7 +123,6 @@ class Repository(object):
target = self._name_to_target(name)
if target.basename in self.ignore:
raise TargetIgnored(name)
-
if name.check(dir=1):
raise IsDirectory(name)
@@ -276,9 +275,11 @@ def cli(ctx, repository):
@pass_repo
def add(repo, verbose, files):
"""Replace file with symlink."""
+ # TODO: repo.dotfiles() for directories
for filename in files:
try:
repo.dotfile(py.path.local(filename)).add(verbose)
+ click.echo('added \'%s\'' % filename)
except DotfileException as err:
click.echo(err)
@@ -290,7 +291,11 @@ def add(repo, verbose, files):
def remove(repo, verbose, files):
"""Replace symlink with file."""
for filename in files:
- repo.dotfile(py.path.local(filename)).remove(verbose)
+ try:
+ repo.dotfile(py.path.local(filename)).remove(verbose)
+ click.echo('removed \'%s\'' % filename)
+ except DotfileException as err:
+ click.echo(err)
@cli.command()
@@ -329,8 +334,13 @@ def status(repo, verbose, color):
@pass_repo
def link(repo, verbose, files):
"""Create missing symlinks."""
+ # TODO: no files should be interpreted as all files with confirmation
for filename in files:
- repo.dotfile(py.path.local(filename)).link(verbose)
+ try:
+ repo.dotfile(py.path.local(filename)).link(verbose)
+ click.echo('linked \'%s\'' % filename)
+ except DotfileException as err:
+ click.echo(err)
@cli.command()
@@ -339,5 +349,10 @@ def link(repo, verbose, files):
@pass_repo
def unlink(repo, verbose, files):
"""Remove existing symlinks."""
+ # TODO: no files should be interpreted as all files with confirmation
for filename in files:
- repo.dotfile(py.path.local(filename)).unlink(verbose)
+ try:
+ repo.dotfile(py.path.local(filename)).unlink(verbose)
+ click.echo('unlinked \'%s\'' % filename)
+ except DotfileException as err:
+ click.echo(err)