1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-07 11:38:30 +00:00

refactor links and add more tests

This commit is contained in:
deadc0de6
2019-04-04 12:13:47 +02:00
parent 584927f10b
commit 5f6cd81465
11 changed files with 679 additions and 73 deletions

View File

@@ -33,9 +33,9 @@ CONFIG = 'config.yaml'
HOMECFG = '~/.config/{}'.format(NAME)
OPT_LINK = {
'nolink': LinkTypes.NOLINK,
'link': LinkTypes.PARENT,
'link_children': LinkTypes.CHILDREN}
LinkTypes.NOLINK.name.lower(): LinkTypes.NOLINK,
LinkTypes.LINK.name.lower(): LinkTypes.LINK,
LinkTypes.LINK_CHILDREN.name.lower(): LinkTypes.LINK_CHILDREN}
BANNER = """ _ _ _
__| | ___ | |_ __| |_ __ ___ _ __
@@ -186,12 +186,15 @@ class Options(AttrMonitor):
# import link default value
self.import_link = self.link_on_import
link = self.args['--link']
if link:
if self.args['--link']:
# overwrite default import link with cli switch
link = self.args['--link']
if link not in OPT_LINK.keys():
self.log.err('bad option for --link: {}'.format(link))
sys.exit(USAGE)
self.import_link = OPT_LINK[link]
if self.debug:
self.log.dbg('link_import value: {}'.format(self.import_link))
# "listfiles" specifics
self.listfiles_templateonly = self.args['--template']