1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-05 17:53:52 +00:00

fix tests

This commit is contained in:
deadc0de6
2019-11-27 20:10:13 +01:00
parent d63424e793
commit 28f39ad0ab
6 changed files with 41 additions and 40 deletions

View File

@@ -410,9 +410,12 @@ def cmd_list_profiles(o):
"""list all profiles"""
LOG.emph('Available profile(s):\n')
for p in o.profiles:
LOG.sub(p.key, end='')
LOG.log(' ({} dotfiles)'.format(len(p.dotfiles)))
#LOG.sub('{} ({} dotfile(s))'.format(p.key, len(p.dotfiles)))
if o.profiles_grepable:
fmt = '{}'.format(p.key)
LOG.raw(fmt)
else:
LOG.sub(p.key, end='')
LOG.log(' ({} dotfiles)'.format(len(p.dotfiles)))
LOG.log('')
@@ -430,10 +433,16 @@ def cmd_list_files(o):
src = os.path.join(o.dotpath, dotfile.src)
if not Templategen.is_template(src):
continue
LOG.log('{}'.format(dotfile.key), bold=True)
LOG.sub('dst: {}'.format(dotfile.dst))
LOG.sub('src: {}'.format(dotfile.src))
LOG.sub('link: {}'.format(dotfile.link.name.lower()))
if o.files_grepable:
fmt = '{},dst:{},src:{},link:{}'
fmt = fmt.format(dotfile.key, dotfile.dst,
dotfile.src, dotfile.link.name.lower())
LOG.raw(fmt)
else:
LOG.log('{}'.format(dotfile.key), bold=True)
LOG.sub('dst: {}'.format(dotfile.dst))
LOG.sub('src: {}'.format(dotfile.src))
LOG.sub('link: {}'.format(dotfile.link.name.lower()))
LOG.log('')

View File

@@ -59,9 +59,9 @@ Usage:
dotdrop update [-VbfdkP] [-c <path>] [-p <profile>]
[-i <pattern>...] [<path>...]
dotdrop remove [-Vbfdk] [-c <path>] [-p <profile>] [<path>...]
dotdrop files [-VbT] [-c <path>] [-p <profile>]
dotdrop files [-VbTG] [-c <path>] [-p <profile>]
dotdrop detail [-Vb] [-c <path>] [-p <profile>] [<key>...]
dotdrop profiles [-Vb] [-c <path>]
dotdrop profiles [-VbG] [-c <path>]
dotdrop --help
dotdrop --version
@@ -83,6 +83,7 @@ Options:
-V --verbose Be verbose.
-d --dry Dry run.
-b --no-banner Do not display the banner.
-G --grepable Grepable output.
-v --version Show version.
-h --help Show this screen.
""".format(BANNER, PROFILE)
@@ -214,6 +215,9 @@ class Options(AttrMonitor):
# "files" specifics
self.files_templateonly = self.args['--template']
self.files_grepable = self.args['--grepable']
# "profiles" specifics
self.profiles_grepable = self.args['--grepable']
# "install" specifics
self.install_force_action = self.args['--force-actions']
self.install_temporary = self.args['--temp']

View File

@@ -125,13 +125,12 @@ set -e
# test values have been correctly updated
echo "========> test for updated entries"
dotfiles=`cd ${ddpath} | ${bin} files -c ${cfg} -p p1 | grep -v '^ '`
echo "${dotfiles}" | grep '^f_link ' | grep ', link: link)'
echo "${dotfiles}" | grep '^f_nolink ' | grep ', link: nolink)'
echo "${dotfiles}" | grep '^f_nolink1 ' | grep ', link: nolink)'
echo "${dotfiles}" | grep '^f_children ' | grep ', link: link_children)'
echo "${dotfiles}" | grep '^f_children2 ' | grep ', link: link_children)'
echo "${dotfiles}" | grep '^f_children3 ' | grep ', link: nolink)'
cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -G | grep '^f_link' | head -1 | grep ',link:link$'
cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -G | grep '^f_nolink' | head -1 | grep ',link:nolink$'
cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -G | grep '^f_nolink1' | head -1 | grep ',link:nolink$'
cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -G | grep '^f_children' | head -1 | grep ',link:link_children$'
cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -G | grep '^f_children2' | head -1 | grep ',link:link_children$'
cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -G | grep '^f_children3' | head -1 | grep ',link:nolink$'
## CLEANING
rm -rf ${tmps} ${tmpd}

View File

@@ -88,8 +88,7 @@ _EOF
cd ${ddpath} | ${bin} import -c ${cfg} -p p1 -V --link=link_children ${dt}
# check is set to link_children
line=$(cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V | grep "d_`basename ${dt}`")
echo ${line} | grep 'link: link_children'
cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V -G | grep "d_`basename ${dt}`" | grep ',link:link_children$'
# checks file exists in dotpath
[ ! -e ${dotpath}/${dt} ] && echo "dotfile not imported" && exit 1

View File

@@ -79,8 +79,7 @@ cd ${ddpath} | ${bin} import -c ${cfg} -p p1 ${df} -V
# checks
cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V
line=$(cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V | grep "f_`basename ${df}`")
echo ${line} | grep 'link: nolink'
cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V -G | grep "f_`basename ${df}`" | head -1 | grep ',link:nolink$'
# try to install
rm -rf ${tmpd}/qwert
@@ -114,8 +113,7 @@ cd ${ddpath} | ${bin} import -c ${cfg} -p p1 ${df} -V
# checks
cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V
line=$(cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V | grep "f_`basename ${df}`")
echo ${line} | grep 'link: nolink'
cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V -G | grep "f_`basename ${df}`" | head -1 | grep ',link:nolink$'
# try to install
rm -rf ${tmpd}/qwert
@@ -149,8 +147,7 @@ cd ${ddpath} | ${bin} import -c ${cfg} -p p1 ${df} -V --link=nolink
# checks
cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V
line=$(cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V | grep "f_`basename ${df}`")
echo ${line} | grep 'link: nolink'
cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V -G | grep "f_`basename ${df}`" | head -1 | grep ',link:nolink$'
# try to install
rm -rf ${tmpd}/qwert
@@ -184,8 +181,7 @@ cd ${ddpath} | ${bin} import -c ${cfg} -p p1 ${df} -V --link=link
# checks
cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V
line=$(cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V | grep "f_`basename ${df}`")
echo ${line} | grep 'link: link'
cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V -G | grep "f_`basename ${df}`" | head -1 | grep ',link:link$'
# try to install
rm -rf ${tmpd}/qwert
@@ -219,8 +215,7 @@ cd ${ddpath} | ${bin} import -c ${cfg} -p p1 ${df} -V
# checks
cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V
line=$(cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V | grep "f_`basename ${df}`")
echo ${line} | grep 'link: link'
cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V -G | grep "f_`basename ${df}`" | head -1 | grep ',link:link$'
# try to install
rm -rf ${tmpd}/qwert
@@ -254,8 +249,7 @@ cd ${ddpath} | ${bin} import -c ${cfg} -p p1 ${df} -V --link=nolink
# checks
cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V
line=$(cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V | grep "f_`basename ${df}`")
echo ${line} | grep 'link: nolink'
cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V -G | grep "f_`basename ${df}`" | head -1 | grep ',link:nolink$'
# try to install
rm -rf ${tmpd}/qwert
@@ -289,8 +283,7 @@ cd ${ddpath} | ${bin} import -c ${cfg} -p p1 ${df} -V --link=nolink
# checks
cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V
line=$(cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V | grep "f_`basename ${df}`")
echo ${line} | grep 'link: nolink'
cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V -G | grep "f_`basename ${df}`" | head -1 | grep ',link:nolink$'
# try to install
rm -rf ${tmpd}/qwert
@@ -324,8 +317,7 @@ cd ${ddpath} | ${bin} import -c ${cfg} -p p1 ${df} -V --link=nolink
# checks
cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V
line=$(cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V | grep "f_`basename ${df}`")
echo ${line} | grep 'link: nolink'
cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V -G | grep "f_`basename ${df}`" | head -1 | grep ',link:nolink$'
# try to install
rm -rf ${tmpd}/qwert
@@ -357,8 +349,7 @@ cd ${ddpath} | ${bin} import -c ${cfg} --link=link -p p1 ${df} -V
# checks
cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V
line=$(cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V | grep "f_`basename ${df}`")
echo ${line} | grep 'link: link'
cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V -G | grep "f_`basename ${df}`" | head -1 | grep ',link:link$'
# try to install
rm -rf ${tmpd}/qwert
@@ -419,8 +410,7 @@ cd ${ddpath} | ${bin} import -c ${cfg} --link=link_children -p p1 ${df} -V
# checks
cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V
line=$(cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V | grep "d_`basename ${df}`")
echo ${line} | grep 'link: link_children'
cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V -G | grep "d_`basename ${df}`" | head -1 | grep ',link:link_children$'
# try to install
rm -rf ${tmpd}/qwert
@@ -460,8 +450,7 @@ cd ${ddpath} | ${bin} import -c ${cfg} -p p1 ${df} -V
# checks
cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V
line=$(cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V | grep "d_`basename ${df}`")
echo ${line} | grep 'link: link_children'
cd ${ddpath} | ${bin} files -c ${cfg} -p p1 -V -G | grep "d_`basename ${df}`" | head -1 | grep ',link:link_children$'
# try to install
rm -rf ${tmpd}/qwert

View File

@@ -128,6 +128,7 @@ def _fake_args():
args['--ignore'] = []
args['--show-patch'] = False
args['--force-actions'] = False
args['--grepable'] = False
# cmds
args['profiles'] = False
args['files'] = False