mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-11 23:34:00 +00:00
ensure only one trans_r and one trans_w
This commit is contained in:
@@ -42,7 +42,11 @@ class Dotfile(DictParser):
|
|||||||
self.noempty = noempty
|
self.noempty = noempty
|
||||||
self.src = src
|
self.src = src
|
||||||
self.trans_r = trans_r
|
self.trans_r = trans_r
|
||||||
|
if trans_r and len(self.trans_r) > 1:
|
||||||
|
raise Exception('only one trans_read allowed')
|
||||||
self.trans_w = trans_w
|
self.trans_w = trans_w
|
||||||
|
if trans_w and len(self.trans_w) > 1:
|
||||||
|
raise Exception('only one trans_write allowed')
|
||||||
self.upignore = upignore
|
self.upignore = upignore
|
||||||
|
|
||||||
def get_dotfile_variables(self):
|
def get_dotfile_variables(self):
|
||||||
|
|||||||
@@ -47,8 +47,8 @@ exec bspwm
|
|||||||
for action in actions:
|
for action in actions:
|
||||||
f.write(' {}: {}\n'.format(action.key, action.action))
|
f.write(' {}: {}\n'.format(action.key, action.action))
|
||||||
f.write('trans:\n')
|
f.write('trans:\n')
|
||||||
for action in trans:
|
for tr in trans:
|
||||||
f.write(' {}: {}\n'.format(action.key, action.action))
|
f.write(' {}: {}\n'.format(tr.key, tr.action))
|
||||||
f.write('config:\n')
|
f.write('config:\n')
|
||||||
f.write(' backup: true\n')
|
f.write(' backup: true\n')
|
||||||
f.write(' create: true\n')
|
f.write(' create: true\n')
|
||||||
@@ -64,7 +64,8 @@ exec bspwm
|
|||||||
for action in d.actions:
|
for action in d.actions:
|
||||||
f.write(' - {}\n'.format(action.key))
|
f.write(' - {}\n'.format(action.key))
|
||||||
if d.trans_r:
|
if d.trans_r:
|
||||||
f.write(' trans: {}\n'.format(d.trans_r.key))
|
for tr in d.trans_r:
|
||||||
|
f.write(' trans: {}\n'.format(tr.key))
|
||||||
f.write('profiles:\n')
|
f.write('profiles:\n')
|
||||||
f.write(' {}:\n'.format(profile))
|
f.write(' {}:\n'.format(profile))
|
||||||
f.write(' dotfiles:\n')
|
f.write(' dotfiles:\n')
|
||||||
@@ -165,7 +166,7 @@ exec bspwm
|
|||||||
tr = Action('testtrans', 'post', cmd)
|
tr = Action('testtrans', 'post', cmd)
|
||||||
f9, c9 = create_random_file(tmp, content=trans1)
|
f9, c9 = create_random_file(tmp, content=trans1)
|
||||||
dst9 = os.path.join(dst, get_string(6))
|
dst9 = os.path.join(dst, get_string(6))
|
||||||
d9 = Dotfile(get_string(6), dst9, os.path.basename(f9), trans_r=tr)
|
d9 = Dotfile(get_string(6), dst9, os.path.basename(f9), trans_r=[tr])
|
||||||
|
|
||||||
# to test template
|
# to test template
|
||||||
f10, _ = create_random_file(tmp, content='{{@@ header() @@}}')
|
f10, _ = create_random_file(tmp, content='{{@@ header() @@}}')
|
||||||
|
|||||||
Reference in New Issue
Block a user