mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-04 17:24:46 +00:00
add compare option -L to list only file changed and no diff
This commit is contained in:
@@ -289,16 +289,20 @@ def cmd_compare(o, tmp):
|
|||||||
if os.path.exists(tmpsrc):
|
if os.path.exists(tmpsrc):
|
||||||
remove(tmpsrc, LOG)
|
remove(tmpsrc, LOG)
|
||||||
|
|
||||||
# print diff result
|
|
||||||
if diff == '':
|
if diff == '':
|
||||||
|
# no difference
|
||||||
if o.debug:
|
if o.debug:
|
||||||
line = '=> compare {}: diffing with \"{}\"'
|
line = '=> compare {}: diffing with \"{}\"'
|
||||||
LOG.dbg(line.format(dotfile.key, dotfile.dst))
|
LOG.dbg(line.format(dotfile.key, dotfile.dst))
|
||||||
LOG.dbg('same file')
|
LOG.dbg('same file')
|
||||||
else:
|
else:
|
||||||
|
# print diff results
|
||||||
line = '=> compare {}: diffing with \"{}\"'
|
line = '=> compare {}: diffing with \"{}\"'
|
||||||
LOG.log(line.format(dotfile.key, dotfile.dst))
|
LOG.log(line.format(dotfile.key, dotfile.dst))
|
||||||
LOG.emph(diff)
|
if o.compare_fileonly:
|
||||||
|
LOG.raw('<files are different>')
|
||||||
|
else:
|
||||||
|
LOG.emph(diff)
|
||||||
same = False
|
same = False
|
||||||
|
|
||||||
return same
|
return same
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ Usage:
|
|||||||
dotdrop install [-VbtfndDa] [-c <path>] [-p <profile>] [<key>...]
|
dotdrop install [-VbtfndDa] [-c <path>] [-p <profile>] [<key>...]
|
||||||
dotdrop import [-Vbdf] [-c <path>] [-p <profile>] [-s <path>]
|
dotdrop import [-Vbdf] [-c <path>] [-p <profile>] [-s <path>]
|
||||||
[-l <link>] <path>...
|
[-l <link>] <path>...
|
||||||
dotdrop compare [-Vb] [-c <path>] [-p <profile>]
|
dotdrop compare [-LVb] [-c <path>] [-p <profile>]
|
||||||
[-C <file>...] [-i <pattern>...]
|
[-C <file>...] [-i <pattern>...]
|
||||||
dotdrop update [-VbfdkP] [-c <path>] [-p <profile>]
|
dotdrop update [-VbfdkP] [-c <path>] [-p <profile>]
|
||||||
[-i <pattern>...] [<path>...]
|
[-i <pattern>...] [<path>...]
|
||||||
@@ -71,6 +71,7 @@ Options:
|
|||||||
-C --file=<path> Path of dotfile to compare.
|
-C --file=<path> Path of dotfile to compare.
|
||||||
-i --ignore=<pattern> Pattern to ignore.
|
-i --ignore=<pattern> Pattern to ignore.
|
||||||
-l --link=<link> Link option (nolink|link|link_children).
|
-l --link=<link> Link option (nolink|link|link_children).
|
||||||
|
-L --file-only Do not show diff but only the files that differ.
|
||||||
-p --profile=<profile> Specify the profile to use [default: {}].
|
-p --profile=<profile> Specify the profile to use [default: {}].
|
||||||
-s --as=<path> Import as a different path from actual path.
|
-s --as=<path> Import as a different path from actual path.
|
||||||
-b --no-banner Do not display the banner.
|
-b --no-banner Do not display the banner.
|
||||||
@@ -239,6 +240,7 @@ class Options(AttrMonitor):
|
|||||||
self.compare_ignore.extend(self.cmpignore)
|
self.compare_ignore.extend(self.cmpignore)
|
||||||
self.compare_ignore.append('*{}'.format(self.install_backup_suffix))
|
self.compare_ignore.append('*{}'.format(self.install_backup_suffix))
|
||||||
self.compare_ignore = uniq_list(self.compare_ignore)
|
self.compare_ignore = uniq_list(self.compare_ignore)
|
||||||
|
self.compare_fileonly = self.args['--file-only']
|
||||||
# "import" specifics
|
# "import" specifics
|
||||||
self.import_path = self.args['<path>']
|
self.import_path = self.args['<path>']
|
||||||
self.import_as = self.args['--as']
|
self.import_as = self.args['--as']
|
||||||
|
|||||||
@@ -130,6 +130,7 @@ def _fake_args():
|
|||||||
args['--force-actions'] = False
|
args['--force-actions'] = False
|
||||||
args['--grepable'] = False
|
args['--grepable'] = False
|
||||||
args['--as'] = None
|
args['--as'] = None
|
||||||
|
args['--file-only'] = False
|
||||||
# cmds
|
# cmds
|
||||||
args['profiles'] = False
|
args['profiles'] = False
|
||||||
args['files'] = False
|
args['files'] = False
|
||||||
|
|||||||
Reference in New Issue
Block a user