From ffb94ce64947566db7e1d1a144ebf63a450bf25e Mon Sep 17 00:00:00 2001 From: Jon Bernard Date: Mon, 4 Jan 2016 07:29:50 -0500 Subject: Clean up dotfile state function --- dotfiles.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/dotfiles.py b/dotfiles.py index 18d49aa..04b1394 100644 --- a/dotfiles.py +++ b/dotfiles.py @@ -60,21 +60,17 @@ class Dotfile(object): @property def state(self): - - # lets be optimistic - state = 'ok' - if self.target.check(exists=0): # only for testing, cli should never reach this state - state = 'error' + return 'error' elif self.name.check(exists=0): # no $HOME symlink - state = 'missing' + return 'missing' elif self.name.check(link=0) or not self.name.samefile(self.target): # if name exists but isn't a link to the target - state = 'conflict' + return 'conflict' - return state + return 'ok' def add(self): if self.target.check(exists=1): -- cgit v1.2.3