diff options
-rw-r--r-- | dotfiles/cli.py | 3 | ||||
-rw-r--r-- | dotfiles/core.py | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/dotfiles/cli.py b/dotfiles/cli.py index 2725c06..e9cf19a 100644 --- a/dotfiles/cli.py +++ b/dotfiles/cli.py @@ -43,6 +43,9 @@ def parse_args(): parser.add_option("-C", "--config", type="string", dest="config", help="set configuration file location (default is ~/.dotfilesrc)") + parser.add_option("-H", "--home", type="string", dest="home", + help="set home directory location (default is ~/)") + action_group = OptionGroup(parser, "Actions") action_group.add_option("-a", "--add", action="store_const", dest="action", diff --git a/dotfiles/core.py b/dotfiles/core.py index 5bc472e..22cacb8 100644 --- a/dotfiles/core.py +++ b/dotfiles/core.py @@ -18,11 +18,11 @@ __license__ = "GPL" class Dotfile(object): - def __init__(self, name, target): + def __init__(self, name, target, home): if name.startswith('/'): self.name = name else: - self.name = os.path.expanduser('~/.%s' % name.strip('.')) + self.name = os.path.expanduser(home + '/.%s' % name.strip('.')) self.basename = os.path.basename(self.name) self.target = target.rstrip('/') self.status = '' |