aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Jon Bernard <jbernard@tuxion.com> 2014-01-01 10:25:06 -0500
committerGravatar Jon Bernard <jbernard@tuxion.com> 2014-01-01 10:25:06 -0500
commit88090baaed8c5ee4c9732dd48189989839024aca (patch)
treee209054d5c8c99dbe61c2675308698baaf610f88
parent7a331be07c654db4868e28b5657de46bc04c800a (diff)
downloaddotfiles-88090baaed8c5ee4c9732dd48189989839024aca.tar.gz
dotfiles-88090baaed8c5ee4c9732dd48189989839024aca.tar.bz2
dotfiles-88090baaed8c5ee4c9732dd48189989839024aca.zip
Prevent adding toplevel package directories
This change prevents users from adding toplevel package directories via the add operation in the cli. Until add is package-aware, allowing this behaviour can lead to loss of configuration files if the --force option is later used to sync. Adding packages already-defined packages will be possible in the future, but this patch is necessary to prevent users from reaching an invalid state. Re #20, #27
-rw-r--r--dotfiles/core.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/dotfiles/core.py b/dotfiles/core.py
index 3212939..078e9b6 100644
--- a/dotfiles/core.py
+++ b/dotfiles/core.py
@@ -232,6 +232,9 @@ class Dotfiles(object):
else:
home = self.homedir
target = self._fqpn(file)
+ if action == 'add' and os.path.split(target)[1] in self.packages:
+ print("Skipping \"%s\", packages not yet supported" % file)
+ return
if sub_dir.startswith('.') or file_name.startswith('.'):
dotfile = Dotfile(file, target, home, dry_run=self.dry_run)
getattr(dotfile, action)()