dotfm

My dotfile manager
git clone git://src.gearsix.net/dotfm
Log | Files | Refs | Atom | README | LICENSE

commit d958951cba2b8e29b003079c024d000dd14d5da9
parent 2679e7d4d09d49aa43b000250e69468a4e9e6dc3
Author: gearsix <gearsix@tuta.io>
Date:   Sun, 25 Apr 2021 18:34:59 +0100

6/6 total refactor, bugfixes 3

Diffstat:
Msrc/dotfm.py | 14++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/dotfm.py b/src/dotfm.py @@ -118,13 +118,11 @@ def isdotfile(dotfile_list, query): return found def clearduplicates(dotfile_list, id_index=0): - unique = [] for i, d in enumerate(dotfile_list): - found = -1 for j, dd in enumerate(dotfile_list): - if j < i: - if dd[id_index] == d[id_index]: - dotfile_list.remove(dd) + if j > i and dd[id_index] == d[id_index]: + dotfile_list.remove(d) + break # main/init def init(): @@ -250,7 +248,7 @@ def update(alias, location): debug('updating {} -> {}'.format(alias, location)) known = isdotfile(INSTALLED, alias) if known != -1: - os.system('ln -isv', location, INSTALLED[known][0]) + os.system('ln -isv {} {}'.format(location, INSTALLED[known][0])) else: warn('{} is unrecognised, installing'.format(dotfile)) install(location) @@ -313,6 +311,10 @@ if __name__ == '__main__': for d in ARGS.dotfile: install(os.path.abspath(d)) elif ARGS.cmd == 'update': + if len(ARGS.dotfile) < 2: + debug('invalid number of arguments') + info('usage: "dotfm update DOTFILE LOCATION"') + sys.exit() update(ARGS.dotfile[0], ARGS.dotfile[1]) elif ARGS.cmd == 'remove': for d in ARGS.dotfile: