1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-11 13:09:18 +00:00

refactoring

This commit is contained in:
deadc0de6
2022-09-01 15:26:59 +02:00
parent 76e4563ca9
commit a97dd46d15
4 changed files with 11 additions and 6 deletions

5
docs/usage.md vendored
View File

@@ -60,8 +60,9 @@ Importing `~/.mutt/colors` and then `~/.vim/colors` will result in:
* `d_mutt_colors` and `d_vim_colors` in the long format * `d_mutt_colors` and `d_vim_colors` in the long format
A dotfile can be imported as a different file with the use A dotfile can be imported as a different file with the use
of the command line switch `--as` (effectively selecting the `src` part of the command line switch `--as` (effectively modifying the `src` part
of the dotfile in the config). It is however recommended of the dotfile in the config, that is the location of the dotfile in the
`dotpath`). It is however recommended
to use [templating](templating.md) to avoid duplicates and optimize to use [templating](templating.md) to avoid duplicates and optimize
dotfile management. dotfile management.
```bash ```bash

View File

@@ -308,7 +308,10 @@ class CfgYaml:
return newlink return newlink
def resolve_dotfile_src(self, src, templater=None): def resolve_dotfile_src(self, src, templater=None):
"""resolve dotfile src path""" """
get abs src file from a relative path
in dotpath
"""
newsrc = '' newsrc = ''
if src: if src:
new = src new = src
@@ -340,9 +343,11 @@ class CfgYaml:
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
if profile_key doesn't exist, the profile is created
we test using profiles variable since it merges we test using profiles variable since it merges
imported ones (include, etc) but insert in main imported ones (include, etc) but insert in main
yaml only yaml only
return True if was added
""" """
# 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)

View File

@@ -223,8 +223,6 @@ def strip_home(path):
def must_ignore(paths, ignores, debug=False): def must_ignore(paths, ignores, debug=False):
"""return true if any paths in list matches any ignore patterns""" """return true if any paths in list matches any ignore patterns"""
if debug:
LOG.dbg('must_ignore called', force=True)
if not ignores: if not ignores:
return False return False
if debug: if debug:

3
tests.sh vendored
View File

@@ -39,7 +39,7 @@ echo "testing with pylint"
# R0915: too-many-statements # R0915: too-many-statements
# R0912: too-many-branches # R0912: too-many-branches
# R0911: too-many-return-statements # R0911: too-many-return-statements
# C0209: consider-using-f-string # R0904: too-many-public-methods
pylint \ pylint \
--disable=R0902 \ --disable=R0902 \
--disable=R0913 \ --disable=R0913 \
@@ -48,6 +48,7 @@ pylint \
--disable=R0915 \ --disable=R0915 \
--disable=R0912 \ --disable=R0912 \
--disable=R0911 \ --disable=R0911 \
--disable=R0904 \
dotdrop/ dotdrop/
set +e set +e