mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-09 07:44:16 +00:00
add dotfile to profile
This commit is contained in:
@@ -323,7 +323,12 @@ class CfgYaml:
|
|||||||
return newdst
|
return newdst
|
||||||
|
|
||||||
def add_dotfile_to_profile(self, dotfile_key, profile_key):
|
def add_dotfile_to_profile(self, dotfile_key, profile_key):
|
||||||
"""add an existing dotfile key to a profile_key"""
|
"""
|
||||||
|
add an existing dotfile key to a profile_key
|
||||||
|
we test using profiles variable since it merges
|
||||||
|
imported ones (include, etc) but insert in main
|
||||||
|
yaml only
|
||||||
|
"""
|
||||||
# create the profile if it doesn't exist
|
# create the profile if it doesn't exist
|
||||||
self._new_profile(profile_key)
|
self._new_profile(profile_key)
|
||||||
profile = self.profiles[profile_key]
|
profile = self.profiles[profile_key]
|
||||||
@@ -332,12 +337,15 @@ class CfgYaml:
|
|||||||
if self.key_profile_dotfiles not in profile or \
|
if self.key_profile_dotfiles not in profile or \
|
||||||
profile[self.key_profile_dotfiles] is None:
|
profile[self.key_profile_dotfiles] is None:
|
||||||
profile[self.key_profile_dotfiles] = []
|
profile[self.key_profile_dotfiles] = []
|
||||||
|
self._yaml_dict[self.key_profiles][profile_key] = []
|
||||||
|
|
||||||
# add to the profile
|
# add to the profile
|
||||||
pdfs = profile[self.key_profile_dotfiles]
|
pdfs = profile[self.key_profile_dotfiles]
|
||||||
if self.key_all not in pdfs and \
|
if self.key_all not in pdfs and \
|
||||||
dotfile_key not in pdfs:
|
dotfile_key not in pdfs:
|
||||||
profile[self.key_profile_dotfiles].append(dotfile_key)
|
# append dotfile
|
||||||
|
pro = self._yaml_dict[self.key_profiles][profile_key]
|
||||||
|
pro[self.key_profile_dotfiles].append(dotfile_key)
|
||||||
if self._debug:
|
if self._debug:
|
||||||
msg = 'add \"{}\" to profile \"{}\"'.format(dotfile_key,
|
msg = 'add \"{}\" to profile \"{}\"'.format(dotfile_key,
|
||||||
profile_key)
|
profile_key)
|
||||||
|
|||||||
Reference in New Issue
Block a user