1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-09 14:04:17 +00:00

rename --files to --file and refactor usage option for compare

This commit is contained in:
deadc0de6
2018-09-29 16:12:07 +02:00
parent a375876438
commit b089463337
2 changed files with 7 additions and 7 deletions

View File

@@ -550,7 +550,7 @@ changes to apply to the template:
* Use dotdrop's `compare` command * Use dotdrop's `compare` command
```bash ```bash
# use compare to identify change(s) # use compare to identify change(s)
$ dotdrop compare --files=~/.vimrc $ dotdrop compare --file=~/.vimrc
``` ```
* Install the dotfiles to a temporary directory (using the `install` command and the * Install the dotfiles to a temporary directory (using the `install` command and the

View File

@@ -45,7 +45,7 @@ Usage:
dotdrop install [-tfndVbD] [-c <path>] [-p <profile>] [<key>...] dotdrop install [-tfndVbD] [-c <path>] [-p <profile>] [<key>...]
dotdrop import [-ldVb] [-c <path>] [-p <profile>] <paths>... dotdrop import [-ldVb] [-c <path>] [-p <profile>] <paths>...
dotdrop compare [-Vb] [-c <path>] [-p <profile>] dotdrop compare [-Vb] [-c <path>] [-p <profile>]
[-o <opts>] [-C <files>] [-i <name>...] [-o <opts>] [-C <file>...] [-i <pattern>...]
dotdrop update [-fdVb] [-c <path>] <paths>... dotdrop update [-fdVb] [-c <path>] <paths>...
dotdrop listfiles [-VTb] [-c <path>] [-p <profile>] dotdrop listfiles [-VTb] [-c <path>] [-p <profile>]
dotdrop list [-Vb] [-c <path>] dotdrop list [-Vb] [-c <path>]
@@ -55,8 +55,8 @@ Usage:
Options: Options:
-p --profile=<profile> Specify the profile to use [default: {}]. -p --profile=<profile> Specify the profile to use [default: {}].
-c --cfg=<path> Path to the config [default: config.yaml]. -c --cfg=<path> Path to the config [default: config.yaml].
-C --files=<files> Comma separated list of files to compare. -C --file=<path> Path of dotfile to compare.
-i --ignore=<name> File name to ignore when diffing. -i --ignore=<pattern> Pattern to ignore when diffing.
-o --dopts=<opts> Diff options [default: ]. -o --dopts=<opts> Diff options [default: ].
-n --nodiff Do not diff when installing. -n --nodiff Do not diff when installing.
-t --temp Install to a temporary directory for review. -t --temp Install to a temporary directory for review.
@@ -177,7 +177,7 @@ def _select(selections, dotfiles):
return selected return selected
def compare(opts, conf, tmp, focus=None, ignore=[]): def compare(opts, conf, tmp, focus=[], ignore=[]):
"""compare dotfiles and return True if all identical""" """compare dotfiles and return True if all identical"""
dotfiles = conf.get_dotfiles(opts['profile']) dotfiles = conf.get_dotfiles(opts['profile'])
if dotfiles == []: if dotfiles == []:
@@ -188,7 +188,7 @@ def compare(opts, conf, tmp, focus=None, ignore=[]):
same = True same = True
selected = dotfiles selected = dotfiles
if focus: if focus:
selected = _select(focus.replace(' ', '').split(','), dotfiles) selected = _select(focus, dotfiles)
if len(selected) < 1: if len(selected) < 1:
return False return False
@@ -393,7 +393,7 @@ def main():
# compare local dotfiles with dotfiles stored in dotdrop # compare local dotfiles with dotfiles stored in dotdrop
tmp = get_tmpdir() tmp = get_tmpdir()
opts['dopts'] = args['--dopts'] opts['dopts'] = args['--dopts']
ret = compare(opts, conf, tmp, focus=args['--files'], ret = compare(opts, conf, tmp, focus=args['--file'],
ignore=args['--ignore']) ignore=args['--ignore'])
if os.listdir(tmp): if os.listdir(tmp):
LOG.raw('\ntemporary files available under {}'.format(tmp)) LOG.raw('\ntemporary files available under {}'.format(tmp))