mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-12 05:23:59 +00:00
fix dotfile trans
This commit is contained in:
@@ -816,9 +816,6 @@ class CfgYaml:
|
|||||||
new = {}
|
new = {}
|
||||||
|
|
||||||
for k, val in dotfiles.items():
|
for k, val in dotfiles.items():
|
||||||
# fix depreacated trans
|
|
||||||
self._fix_deprecated_trans_in_dict(val)
|
|
||||||
|
|
||||||
if self.key_dotfile_src not in val:
|
if self.key_dotfile_src not in val:
|
||||||
# add 'src' as key' if not present
|
# add 'src' as key' if not present
|
||||||
val[self.key_dotfile_src] = k
|
val[self.key_dotfile_src] = k
|
||||||
@@ -1193,7 +1190,7 @@ class CfgYaml:
|
|||||||
if old_key in yamldic:
|
if old_key in yamldic:
|
||||||
yamldic[old_key] = yamldic[new_key]
|
yamldic[old_key] = yamldic[new_key]
|
||||||
del yamldic[old_key]
|
del yamldic[old_key]
|
||||||
msg = f'\"{old_key}\" is deprecated, '
|
msg = f'deprecated \"{old_key}\", '
|
||||||
msg += f', updated to {new_key}\"'
|
msg += f', updated to {new_key}\"'
|
||||||
self._log.warn(msg)
|
self._log.warn(msg)
|
||||||
self._dirty = True
|
self._dirty = True
|
||||||
@@ -1225,12 +1222,13 @@ class CfgYaml:
|
|||||||
|
|
||||||
def _fix_deprecated_trans(self, yamldict):
|
def _fix_deprecated_trans(self, yamldict):
|
||||||
"""fix deprecated trans key"""
|
"""fix deprecated trans key"""
|
||||||
if self.key_settings not in yamldict:
|
# top ones
|
||||||
return
|
self._fix_deprecated_trans_in_dict(yamldict)
|
||||||
if not yamldict[self.key_settings]:
|
# dotfiles ones
|
||||||
return
|
if self.key_dotfiles in yamldict and yamldict[self.key_dotfiles]:
|
||||||
config = yamldict[self.key_settings]
|
config = yamldict[self.key_dotfiles]
|
||||||
self._fix_deprecated_trans_in_dict(config)
|
for _, val in config.items():
|
||||||
|
self._fix_deprecated_trans_in_dict(val)
|
||||||
|
|
||||||
def _fix_deprecated_link_by_default(self, yamldict):
|
def _fix_deprecated_link_by_default(self, yamldict):
|
||||||
"""fix deprecated link_by_default"""
|
"""fix deprecated link_by_default"""
|
||||||
|
|||||||
@@ -540,8 +540,8 @@ def cmd_importer(opts):
|
|||||||
import_as=opts.import_as,
|
import_as=opts.import_as,
|
||||||
import_link=opts.import_link,
|
import_link=opts.import_link,
|
||||||
import_mode=opts.import_mode,
|
import_mode=opts.import_mode,
|
||||||
import_trans_install=opts.import_transr,
|
trans_install=opts.import_trans_install,
|
||||||
import_trans_update=opts.import_transw)
|
trans_update=opts.import_trans_update)
|
||||||
if tmpret < 0:
|
if tmpret < 0:
|
||||||
ret = False
|
ret = False
|
||||||
elif tmpret > 0:
|
elif tmpret > 0:
|
||||||
|
|||||||
@@ -95,13 +95,9 @@ class Dotfile(DictParser):
|
|||||||
def _adjust_yaml_keys(cls, value):
|
def _adjust_yaml_keys(cls, value):
|
||||||
"""patch dict"""
|
"""patch dict"""
|
||||||
value['noempty'] = value.get(cls.key_noempty, False)
|
value['noempty'] = value.get(cls.key_noempty, False)
|
||||||
value['trans_install'] = value.get(cls.key_trans_install)
|
|
||||||
value['trans_update'] = value.get(cls.key_trans_update)
|
|
||||||
value['template'] = value.get(cls.key_template, True)
|
value['template'] = value.get(cls.key_template, True)
|
||||||
# remove old entries
|
# remove old entries
|
||||||
value.pop(cls.key_noempty, None)
|
value.pop(cls.key_noempty, None)
|
||||||
value.pop(cls.key_trans_install, None)
|
|
||||||
value.pop(cls.key_trans_update, None)
|
|
||||||
return value
|
return value
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
|
|||||||
@@ -75,8 +75,8 @@ class Importer:
|
|||||||
def import_path(self, path, import_as=None,
|
def import_path(self, path, import_as=None,
|
||||||
import_link=LinkTypes.NOLINK,
|
import_link=LinkTypes.NOLINK,
|
||||||
import_mode=False,
|
import_mode=False,
|
||||||
import_trans_install="",
|
trans_install="",
|
||||||
import_trans_update=""):
|
trans_update=""):
|
||||||
"""
|
"""
|
||||||
import a dotfile pointed by path
|
import a dotfile pointed by path
|
||||||
returns:
|
returns:
|
||||||
@@ -93,10 +93,10 @@ class Importer:
|
|||||||
# check trans_update if any
|
# check trans_update if any
|
||||||
trans_install = None
|
trans_install = None
|
||||||
trans_update = None
|
trans_update = None
|
||||||
if import_trans_install:
|
if trans_install:
|
||||||
trans_install = self.conf.get_trans_install(import_trans_install)
|
trans_install = self.conf.get_trans_install(trans_install)
|
||||||
if import_trans_update:
|
if trans_update:
|
||||||
trans_update = self.conf.get_trans_update(import_trans_update)
|
trans_update = self.conf.get_trans_update(trans_update)
|
||||||
|
|
||||||
return self._import(path, import_as=import_as,
|
return self._import(path, import_as=import_as,
|
||||||
import_link=import_link,
|
import_link=import_link,
|
||||||
|
|||||||
Reference in New Issue
Block a user