diff --git a/dotdrop/dotdrop.py b/dotdrop/dotdrop.py index 4712458..c6ca4a6 100644 --- a/dotdrop/dotdrop.py +++ b/dotdrop/dotdrop.py @@ -289,16 +289,20 @@ def cmd_compare(o, tmp): if os.path.exists(tmpsrc): remove(tmpsrc, LOG) - # print diff result if diff == '': + # no difference if o.debug: line = '=> compare {}: diffing with \"{}\"' LOG.dbg(line.format(dotfile.key, dotfile.dst)) LOG.dbg('same file') else: + # print diff results line = '=> compare {}: diffing with \"{}\"' LOG.log(line.format(dotfile.key, dotfile.dst)) - LOG.emph(diff) + if o.compare_fileonly: + LOG.raw('') + else: + LOG.emph(diff) same = False return same diff --git a/dotdrop/options.py b/dotdrop/options.py index 6f64593..47dc835 100644 --- a/dotdrop/options.py +++ b/dotdrop/options.py @@ -54,7 +54,7 @@ Usage: dotdrop install [-VbtfndDa] [-c ] [-p ] [...] dotdrop import [-Vbdf] [-c ] [-p ] [-s ] [-l ] ... - dotdrop compare [-Vb] [-c ] [-p ] + dotdrop compare [-LVb] [-c ] [-p ] [-C ...] [-i ...] dotdrop update [-VbfdkP] [-c ] [-p ] [-i ...] [...] @@ -71,6 +71,7 @@ Options: -C --file= Path of dotfile to compare. -i --ignore= Pattern to ignore. -l --link= Link option (nolink|link|link_children). + -L --file-only Do not show diff but only the files that differ. -p --profile= Specify the profile to use [default: {}]. -s --as= Import as a different path from actual path. -b --no-banner Do not display the banner. @@ -239,6 +240,7 @@ class Options(AttrMonitor): self.compare_ignore.extend(self.cmpignore) self.compare_ignore.append('*{}'.format(self.install_backup_suffix)) self.compare_ignore = uniq_list(self.compare_ignore) + self.compare_fileonly = self.args['--file-only'] # "import" specifics self.import_path = self.args[''] self.import_as = self.args['--as'] diff --git a/tests/helpers.py b/tests/helpers.py index ed2ae0e..d6347c2 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -130,6 +130,7 @@ def _fake_args(): args['--force-actions'] = False args['--grepable'] = False args['--as'] = None + args['--file-only'] = False # cmds args['profiles'] = False args['files'] = False