diff options
author | Jon Bernard <jbernard@tuxion.com> | 2016-01-20 11:22:51 -0500 |
---|---|---|
committer | Jon Bernard <jbernard@tuxion.com> | 2016-01-20 11:22:51 -0500 |
commit | f8ec4aa18980aaafc1a0e7f35563a6ad4b7d9ebc (patch) | |
tree | 08584d2815a1d00f3b652692811a6a5bde10afcf | |
parent | 88e1327d755e033fdcfd2679d33b6b3e22c7c737 (diff) | |
download | dotfiles-f8ec4aa18980aaafc1a0e7f35563a6ad4b7d9ebc.tar.gz dotfiles-f8ec4aa18980aaafc1a0e7f35563a6ad4b7d9ebc.tar.bz2 dotfiles-f8ec4aa18980aaafc1a0e7f35563a6ad4b7d9ebc.zip |
Improve docstrings in cli
-rw-r--r-- | dotfiles/cli.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/dotfiles/cli.py b/dotfiles/cli.py index f1625eb..7dbac4f 100644 --- a/dotfiles/cli.py +++ b/dotfiles/cli.py @@ -1,5 +1,4 @@ import os -import py import click from .repository import Repository @@ -7,17 +6,25 @@ from .exceptions import DotfileException DEFAULT_REPODIR = os.path.expanduser('~/Dotfiles') +DEFAULT_IGNORE = ['.git', '.hg'] +DEFAULT_DOT = True def confirm(method, files, repo): + """Return a list of files, or all files if none were specified.""" + if files: + # user has specified specific files, so we are not assuming all return files + + # no files provided, so we assume all files after confimration message = 'Are you sure you want to %s all dotfiles?' % method click.confirm(message, abort=True) return str(repo).split() def perform(method, files, repo, debug): + """Perform an operation on a set of dotfiles.""" for dotfile in repo.dotfiles(files): try: getattr(dotfile, method)(debug) @@ -55,7 +62,7 @@ def cli(ctx, repo): @click.argument('files', nargs=-1, type=click.Path(exists=True)) @pass_repo def add(repo, debug, files): - """Replace file with symlink.""" + """Add dotfiles to your repository.""" perform('add', files, repo, debug) @@ -65,7 +72,7 @@ def add(repo, debug, files): @click.argument('files', nargs=-1, type=click.Path(exists=True)) @pass_repo def remove(repo, debug, files): - """Replace symlink with file.""" + """Remove dotfiles from your repository.""" files = confirm('remove', files, repo) perform('remove', files, repo, debug) if not debug: |