aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Jon Bernard <jbernard@tuxion.com> 2016-01-20 11:23:57 -0500
committerGravatar Jon Bernard <jbernard@tuxion.com> 2016-01-20 11:23:57 -0500
commitb9d3f5c41764439bf812c1d077eb44a1c52b3675 (patch)
treea1c4c2b7c9e3c789b69407dd406bf2233e434b14
parenteb5902c00a8b41e2bb6b0710e33004c2340c9319 (diff)
downloaddotfiles-b9d3f5c41764439bf812c1d077eb44a1c52b3675.tar.gz
dotfiles-b9d3f5c41764439bf812c1d077eb44a1c52b3675.tar.bz2
dotfiles-b9d3f5c41764439bf812c1d077eb44a1c52b3675.zip
Expose --dot/--no-dot in cli
-rw-r--r--dotfiles/cli.py7
-rw-r--r--dotfiles/repository.py8
2 files changed, 9 insertions, 6 deletions
diff --git a/dotfiles/cli.py b/dotfiles/cli.py
index 7dbac4f..fc6e0d3 100644
--- a/dotfiles/cli.py
+++ b/dotfiles/cli.py
@@ -41,19 +41,22 @@ pass_repo = click.make_pass_decorator(Repository)
@click.group(context_settings=dict(help_option_names=['-h', '--help']))
@click.option('-r', '--repo', type=click.Path(), show_default=True,
default=DEFAULT_REPODIR, envvar='DOTFILES_REPO')
+@click.option('--dot/--no-dot', default=True, show_default=DEFAULT_DOT,
+ envvar='DOTFILES_DOT')
@click.version_option()
@click.pass_context
-def cli(ctx, repo):
+def cli(ctx, repo, dot):
"""Dotfiles is a tool to make managing your dotfile symlinks in $HOME easy,
allowing you to keep all your dotfiles in a single directory.
The following environment variables are recognized at runtime:
\b
+ DOTFILES_DOT: Set this to 'False' to remove the leading dot.
DOTFILES_REPO: Set this to the location of your repository.
DOTFILES_COLOR: Set this to 'True' to enable color output.
"""
- ctx.obj = Repository(py.path.local(py.path.local(repo)))
+ ctx.obj = Repository(repodir=repo, ignore=DEFAULT_IGNORE, dot=dot)
@cli.command()
diff --git a/dotfiles/repository.py b/dotfiles/repository.py
index 27e988e..86b975c 100644
--- a/dotfiles/repository.py
+++ b/dotfiles/repository.py
@@ -13,14 +13,14 @@ class Repository(object):
:param repodir: the location of the repository directory
:param homedir: the location of the home directory (primarily for testing)
:param ignore: a list of targets to ignore
+ :param dot: wether to preserve the target's leading dot
"""
homedir = py.path.local('~/', expanduser=True)
- ignore = ['.git', '.hg']
- def __init__(self, repodir, homedir=homedir, ignore=ignore, dot=True):
- self.repodir = repodir.ensure(dir=1)
- self.homedir = homedir
+ def __init__(self, repodir, homedir=homedir, ignore=[], dot=True):
+ self.repodir = py.path.local(repodir).ensure_dir()
+ self.homedir = py.path.local(homedir)
self.ignore = ignore
self.dot = dot