mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-11 13:44:16 +00:00
refactoring
This commit is contained in:
@@ -47,8 +47,9 @@ def cmd_install(o):
|
|||||||
inst = Installer(create=o.create, backup=o.backup,
|
inst = Installer(create=o.create, backup=o.backup,
|
||||||
dry=o.dry, safe=o.safe,
|
dry=o.dry, safe=o.safe,
|
||||||
base=o.dotpath, workdir=o.workdir,
|
base=o.dotpath, workdir=o.workdir,
|
||||||
diff=o.installdiff, debug=o.debug,
|
diff=o.install_diff, debug=o.debug,
|
||||||
totemp=tmpdir, showdiff=o.showdiff)
|
totemp=tmpdir,
|
||||||
|
showdiff=o.install_showdiff)
|
||||||
installed = []
|
installed = []
|
||||||
for dotfile in dotfiles:
|
for dotfile in dotfiles:
|
||||||
preactions = []
|
preactions = []
|
||||||
|
|||||||
@@ -32,13 +32,13 @@ USAGE = """
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
dotdrop install [-tfndVbD] [-c <path>] [-p <profile>] [<key>...]
|
dotdrop install [-VbtfndD] [-c <path>] [-p <profile>] [<key>...]
|
||||||
dotdrop import [-ldVb] [-c <path>] [-p <profile>] <path>...
|
dotdrop import [-Vbld] [-c <path>] [-p <profile>] <path>...
|
||||||
dotdrop compare [-Vb] [-c <path>] [-p <profile>]
|
dotdrop compare [-Vb] [-c <path>] [-p <profile>]
|
||||||
[-o <opts>] [-C <file>...] [-i <pattern>...]
|
[-o <opts>] [-C <file>...] [-i <pattern>...]
|
||||||
dotdrop update [-fdVbkP] [-c <path>] [-p <profile>]
|
dotdrop update [-VbfdkP] [-c <path>] [-p <profile>]
|
||||||
[-i <pattern>...] [<path>...]
|
[-i <pattern>...] [<path>...]
|
||||||
dotdrop listfiles [-VTb] [-c <path>] [-p <profile>]
|
dotdrop listfiles [-VbT] [-c <path>] [-p <profile>]
|
||||||
dotdrop detail [-Vb] [-c <path>] [-p <profile>] [<key>...]
|
dotdrop detail [-Vb] [-c <path>] [-p <profile>] [<key>...]
|
||||||
dotdrop list [-Vb] [-c <path>]
|
dotdrop list [-Vb] [-c <path>]
|
||||||
dotdrop --help
|
dotdrop --help
|
||||||
@@ -71,7 +71,7 @@ class Options:
|
|||||||
|
|
||||||
def __init__(self, args=None):
|
def __init__(self, args=None):
|
||||||
"""constructor
|
"""constructor
|
||||||
@args: argument dictionary (if non use sys)
|
@args: argument dictionary (if None use sys)
|
||||||
"""
|
"""
|
||||||
self.args = args
|
self.args = args
|
||||||
if not args:
|
if not args:
|
||||||
@@ -117,8 +117,6 @@ class Options:
|
|||||||
self.dry = self.args['--dry']
|
self.dry = self.args['--dry']
|
||||||
self.profile = self.args['--profile']
|
self.profile = self.args['--profile']
|
||||||
self.safe = not self.args['--force']
|
self.safe = not self.args['--force']
|
||||||
self.installdiff = not self.args['--nodiff']
|
|
||||||
self.showdiff = self.showdiff or self.args['--showdiff']
|
|
||||||
self.link = LinkTypes.NOLINK
|
self.link = LinkTypes.NOLINK
|
||||||
if self.link_by_default:
|
if self.link_by_default:
|
||||||
self.link = LinkTypes.PARENTS
|
self.link = LinkTypes.PARENTS
|
||||||
@@ -135,6 +133,8 @@ class Options:
|
|||||||
# "install" specifics
|
# "install" specifics
|
||||||
self.install_temporary = self.args['--temp']
|
self.install_temporary = self.args['--temp']
|
||||||
self.install_keys = self.args['<key>']
|
self.install_keys = self.args['<key>']
|
||||||
|
self.install_diff = not self.args['--nodiff']
|
||||||
|
self.install_showdiff = self.showdiff or self.args['--showdiff']
|
||||||
# "compare" specifics
|
# "compare" specifics
|
||||||
self.compare_dopts = self.args['--dopts']
|
self.compare_dopts = self.args['--dopts']
|
||||||
self.compare_focus = self.args['--file']
|
self.compare_focus = self.args['--file']
|
||||||
|
|||||||
@@ -124,9 +124,9 @@ def load_options(confpath, profile):
|
|||||||
o.dry = False
|
o.dry = False
|
||||||
o.profile = profile
|
o.profile = profile
|
||||||
o.safe = True
|
o.safe = True
|
||||||
o.installdiff = True
|
o.install_diff = True
|
||||||
o.link = LinkTypes.NOLINK.value
|
o.link = LinkTypes.NOLINK.value
|
||||||
o.showdiff = True
|
o.install_showdiff = True
|
||||||
o.debug = True
|
o.debug = True
|
||||||
o.dopts = ''
|
o.dopts = ''
|
||||||
o.variables = {}
|
o.variables = {}
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ exec bspwm
|
|||||||
o = load_options(confpath, profile)
|
o = load_options(confpath, profile)
|
||||||
o.safe = False
|
o.safe = False
|
||||||
o.debug = True
|
o.debug = True
|
||||||
o.showdiff = True
|
o.install_showdiff = True
|
||||||
o.variables = {}
|
o.variables = {}
|
||||||
cmd_install(o)
|
cmd_install(o)
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ class TestUpdate(unittest.TestCase):
|
|||||||
create=self.CONFIG_CREATE)
|
create=self.CONFIG_CREATE)
|
||||||
self.assertTrue(os.path.exists(confpath))
|
self.assertTrue(os.path.exists(confpath))
|
||||||
o = load_options(confpath, profile)
|
o = load_options(confpath, profile)
|
||||||
|
o.debug = True
|
||||||
dfiles = [d1, dir1, d2]
|
dfiles = [d1, dir1, d2]
|
||||||
|
|
||||||
# import the files
|
# import the files
|
||||||
|
|||||||
Reference in New Issue
Block a user