summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Jon Bernard <jbernard@tuxion.com> 2013-07-31 20:38:06 -0400
committerGravatar Jon Bernard <jbernard@tuxion.com> 2013-11-07 09:38:44 -0500
commita04da147f8e170a64fcec425a77affb8f02424da (patch)
treed826981cc416752b7c52e14c52c33eefbd47b4ae
parentdb0e9d1130dfd212ca6f2e862b8b9a3b875a4f1b (diff)
downloaddotfiles-a04da147f8e170a64fcec425a77affb8f02424da.tar.gz
dotfiles-a04da147f8e170a64fcec425a77affb8f02424da.tar.bz2
dotfiles-a04da147f8e170a64fcec425a77affb8f02424da.zip
Implement single-sync for specified files
This commit allows the user to sync only one (or a subset) of the available dotfiles in the repository.
-rw-r--r--dotfiles/core.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/dotfiles/core.py b/dotfiles/core.py
index 8ef0782..b2e2d0c 100644
--- a/dotfiles/core.py
+++ b/dotfiles/core.py
@@ -189,9 +189,14 @@ class Dotfiles(object):
# unless a set of files is specified, operate on all files
if not files:
- files = self.dotfiles
+ dotfiles = self.dotfiles
+ else:
+ files = map(lambda x: os.path.join(self.homedir, x), files)
+ dotfiles = [x for x in self.dotfiles if x.name in files]
+ if not dotfiles:
+ raise Exception("file not found")
- for dotfile in files:
+ for dotfile in dotfiles:
dotfile.sync(force)
def add(self, files):