1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-08 07:54:16 +00:00

respect create: false in install --temp for #326

This commit is contained in:
deadc0de6
2021-10-11 17:42:00 +02:00
parent 7671266fa6
commit 0bde2ab6b6
3 changed files with 11 additions and 6 deletions

View File

@@ -84,7 +84,7 @@ A dotfile will be installed only if it differs from the version already present
Some available options: Some available options:
* `-t`/`--temp`: Install the dotfile(s) to a temporary directory for review (helping to debug templating issues, for example). * `-t`/`--temp`: Install the dotfile(s) to a temporary directory for review (helping to debug templating issues, for example).
Note that actions are not executed in this mode and the config entry `create` is always considered to be `true`. Note that actions are not executed in this mode.
* `-a`/`--force-actions`: Force the execution of actions even if the dotfiles are not installed * `-a`/`--force-actions`: Force the execution of actions even if the dotfiles are not installed
* `-f`/`--force`: Do not ask for any confirmation * `-f`/`--force`: Do not ask for any confirmation

View File

@@ -145,7 +145,8 @@ def _dotfile_compare(opts, dotfile, tmp):
# install dotfile to temporary dir for compare # install dotfile to temporary dir for compare
ret, err, insttmp = inst.install_to_temp(templ, tmp, src, dotfile.dst, ret, err, insttmp = inst.install_to_temp(templ, tmp, src, dotfile.dst,
is_template=True, is_template=True,
chmod=dotfile.chmod) chmod=dotfile.chmod,
set_create=True)
if not ret: if not ret:
# failed to install to tmp # failed to install to tmp
line = '=> compare {} error: {}' line = '=> compare {} error: {}'

View File

@@ -185,7 +185,8 @@ class Installer:
return self._log_install(ret, err) return self._log_install(ret, err)
def install_to_temp(self, templater, tmpdir, src, dst, def install_to_temp(self, templater, tmpdir, src, dst,
is_template=True, chmod=None, ignore=None): is_template=True, chmod=None, ignore=None,
set_create=False):
""" """
install a dotfile to a tempdir install a dotfile to a tempdir
@@ -196,6 +197,7 @@ class Installer:
@is_template: this dotfile is a template @is_template: this dotfile is a template
@chmod: rights to apply if any @chmod: rights to apply if any
@ignore: patterns to ignore @ignore: patterns to ignore
@set_create: force create to True
return return
- success, error-if-any, dotfile-installed-path - success, error-if-any, dotfile-installed-path
@@ -215,8 +217,9 @@ class Installer:
self.dry = False self.dry = False
diffsaved = self.diff diffsaved = self.diff
self.diff = False self.diff = False
createsaved = self.create if set_create:
self.create = True createsaved = self.create
self.create = True
totemp = self.totemp totemp = self.totemp
self.totemp = None self.totemp = None
@@ -232,7 +235,8 @@ class Installer:
# restore flags # restore flags
self.dry = drysaved self.dry = drysaved
self.diff = diffsaved self.diff = diffsaved
self.create = createsaved if set_create:
self.create = createsaved
self.comparing = False self.comparing = False
self.totemp = totemp self.totemp = totemp