mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-11 16:04:00 +00:00
auto rename link_by_default to link_import_default for #110
This commit is contained in:
@@ -153,7 +153,6 @@ config:
|
|||||||
dotpath: dotfiles
|
dotpath: dotfiles
|
||||||
ignoreempty: false
|
ignoreempty: false
|
||||||
keepdot: false
|
keepdot: false
|
||||||
link_by_default: false
|
|
||||||
longkey: false
|
longkey: false
|
||||||
showdiff: false
|
showdiff: false
|
||||||
workdir: ~/.config/dotdrop
|
workdir: ~/.config/dotdrop
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ config:
|
|||||||
banner: true
|
banner: true
|
||||||
longkey: false
|
longkey: false
|
||||||
keepdot: false
|
keepdot: false
|
||||||
link_by_default: false
|
link_import_default: false
|
||||||
|
link_install_default: nolink
|
||||||
dotfiles:
|
dotfiles:
|
||||||
profiles:
|
profiles:
|
||||||
|
|||||||
@@ -31,11 +31,17 @@ class Cfg:
|
|||||||
key_keepdot = 'keepdot'
|
key_keepdot = 'keepdot'
|
||||||
key_ignoreempty = 'ignoreempty'
|
key_ignoreempty = 'ignoreempty'
|
||||||
key_showdiff = 'showdiff'
|
key_showdiff = 'showdiff'
|
||||||
key_imp_link = 'link_by_default'
|
key_imp_link = 'link_import_default'
|
||||||
key_inst_link = 'link_install_default'
|
key_inst_link = 'link_install_default'
|
||||||
key_workdir = 'workdir'
|
key_workdir = 'workdir'
|
||||||
key_include_vars = 'import_variables'
|
key_include_vars = 'import_variables'
|
||||||
|
|
||||||
|
# below entries will be automatically transformed
|
||||||
|
# to their new counterpart
|
||||||
|
key_deprecated = {
|
||||||
|
'link_by_default': key_imp_link,
|
||||||
|
}
|
||||||
|
|
||||||
# actions keys
|
# actions keys
|
||||||
key_actions = 'actions'
|
key_actions = 'actions'
|
||||||
key_actions_pre = 'pre'
|
key_actions_pre = 'pre'
|
||||||
@@ -557,6 +563,7 @@ class Cfg:
|
|||||||
|
|
||||||
def _complete_settings(self):
|
def _complete_settings(self):
|
||||||
"""set settings defaults if not present"""
|
"""set settings defaults if not present"""
|
||||||
|
self._deprecated()
|
||||||
if self.key_dotpath not in self.lnk_settings:
|
if self.key_dotpath not in self.lnk_settings:
|
||||||
self.lnk_settings[self.key_dotpath] = self.default_dotpath
|
self.lnk_settings[self.key_dotpath] = self.default_dotpath
|
||||||
if self.key_backup not in self.lnk_settings:
|
if self.key_backup not in self.lnk_settings:
|
||||||
@@ -580,6 +587,15 @@ class Cfg:
|
|||||||
if self.key_inst_link not in self.lnk_settings:
|
if self.key_inst_link not in self.lnk_settings:
|
||||||
self.lnk_settings[self.key_inst_link] = self.default_link_inst
|
self.lnk_settings[self.key_inst_link] = self.default_link_inst
|
||||||
|
|
||||||
|
def _deprecated(self):
|
||||||
|
"""fix deprecated entries"""
|
||||||
|
for k, v in self.key_deprecated.items():
|
||||||
|
if k in self.lnk_settings:
|
||||||
|
# replace
|
||||||
|
entry = self.lnk_settings[k]
|
||||||
|
self.lnk_settings[v] = entry
|
||||||
|
del self.lnk_settings[k]
|
||||||
|
|
||||||
def _save(self, content, path):
|
def _save(self, content, path):
|
||||||
"""writes the config to file"""
|
"""writes the config to file"""
|
||||||
ret = False
|
ret = False
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ Options:
|
|||||||
-t --temp Install to a temporary directory for review.
|
-t --temp Install to a temporary directory for review.
|
||||||
-T --template Only template dotfiles.
|
-T --template Only template dotfiles.
|
||||||
-D --showdiff Show a diff before overwriting.
|
-D --showdiff Show a diff before overwriting.
|
||||||
-l --inv-link Invert the value of "link_by_default" when importing.
|
-l --inv-link Invert "link_import_default" when importing.
|
||||||
-P --show-patch Provide a one-liner to manually patch template.
|
-P --show-patch Provide a one-liner to manually patch template.
|
||||||
-f --force Do not warn if exists.
|
-f --force Do not warn if exists.
|
||||||
-k --key Treat <path> as a dotfile key.
|
-k --key Treat <path> as a dotfile key.
|
||||||
@@ -177,7 +177,7 @@ class Options(AttrMonitor):
|
|||||||
self.dry = self.args['--dry']
|
self.dry = self.args['--dry']
|
||||||
self.safe = not self.args['--force']
|
self.safe = not self.args['--force']
|
||||||
self.link = LinkTypes.NOLINK
|
self.link = LinkTypes.NOLINK
|
||||||
if self.link_by_default:
|
if self.link_import_default:
|
||||||
self.link = LinkTypes.PARENT
|
self.link = LinkTypes.PARENT
|
||||||
|
|
||||||
if self.args['--inv-link']:
|
if self.args['--inv-link']:
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ _EOF
|
|||||||
|
|
||||||
# install
|
# install
|
||||||
cd ${ddpath} | ${bin} install -f -c ${cfg} -p p1 -V
|
cd ${ddpath} | ${bin} install -f -c ${cfg} -p p1 -V
|
||||||
cat ${cfg}
|
#cat ${cfg}
|
||||||
|
|
||||||
# ensure exists and is not link
|
# ensure exists and is not link
|
||||||
[ ! -d ${tmpd}/abc ] && echo "not a directory" && exit 1
|
[ ! -d ${tmpd}/abc ] && echo "not a directory" && exit 1
|
||||||
@@ -109,7 +109,7 @@ _EOF
|
|||||||
|
|
||||||
# install
|
# install
|
||||||
cd ${ddpath} | ${bin} install -f -c ${cfg} -p p1 -V
|
cd ${ddpath} | ${bin} install -f -c ${cfg} -p p1 -V
|
||||||
cat ${cfg}
|
#cat ${cfg}
|
||||||
|
|
||||||
# ensure exists and parent is a link
|
# ensure exists and parent is a link
|
||||||
[ ! -e ${tmpd}/abc ] && echo "not exist" && exit 1
|
[ ! -e ${tmpd}/abc ] && echo "not exist" && exit 1
|
||||||
@@ -138,7 +138,7 @@ _EOF
|
|||||||
|
|
||||||
# install
|
# install
|
||||||
cd ${ddpath} | ${bin} install -f -c ${cfg} -p p1 -V
|
cd ${ddpath} | ${bin} install -f -c ${cfg} -p p1 -V
|
||||||
cat ${cfg}
|
#cat ${cfg}
|
||||||
|
|
||||||
# ensure exists and children are links
|
# ensure exists and children are links
|
||||||
tree ${tmpd}
|
tree ${tmpd}
|
||||||
|
|||||||
Reference in New Issue
Block a user