dotfm

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

commit 29fd26441bc6f2c478f7f185b3e66482a5844090
parent 7bb7c1099c4e1ec8f23762a1db67d713f3064e9c
Author: gearsix <gearsix@tuta.io>
Date:   Mon, 27 Sep 2021 15:38:23 +0100

Merge branch 'develop' of https://notabug.org/gearsix/dotfm into develop

Diffstat:
MMakefile | 2+-
MREADME | 2+-
Msrc/dotfm.1 | 7++++---
Msrc/dotfm.py | 9+++++----
4 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/Makefile b/Makefile @@ -17,7 +17,7 @@ install: link: ln -si ${CURRDIR}/src/${NAME}.py ${DESTBINDIR}/${NAME} @echo 'WARNING! moving ${CURRDIR}/src/dotfm.py will break this link' - mkdir -p ${DESKMANDIR}/man1 + mkdir -p ${DESTMANDIR}/man1 ln -si ${CURRDIR}/src/${NAME}.1 ${DESTMANDIR}/man1/${NAME}.1 ln -si ${DESTMANDIR}/man1/${NAME}.1 /usr/share/man/man1/${NAME}.1 diff --git a/README b/README @@ -19,7 +19,7 @@ ARGUMENTS COMMANDS Multiple DOTFILE args can be passed to each command. - install <DOTFILE> ... + install <DOTFILE> ... create a symlink from DOTFILE to it's install location. DOTFILE should be the filepath of the dotfile to install. diff --git a/src/dotfm.1 b/src/dotfm.1 @@ -1,6 +1,6 @@ .\" txt2man -d "$(date)" -t "dotfm" -s 1 -v "dotfm README" -r "v2.2.0" -s 1 README .\" Text automatically generated by txt2man -.TH dotfm 1 "Sun 25 Apr 18:41:28 BST 2021" "v2.2.0" "dotfm README" +.TH dotfm 1 "Tue 10 Aug 11:05:27 BST 2021" "v2.2.0" "dotfm README" .SH NAME \fBdotfm \fP- a simple script to manage dotfiles. \fB @@ -37,8 +37,9 @@ Display \fBdotfm\fP version Tell \fBdotfm\fP to shutup (hide info logs) .SH COMMANDS Multiple DOTFILE args can be passed to each command. -.PP -install <DOTFILE> \.\.\. +.TP +.B +install <DOTFILE> \.\.\. create a symlink from DOTFILE to it's install location. DOTFILE should be the filepath of the dotfile to install. .RS diff --git a/src/dotfm.py b/src/dotfm.py @@ -147,7 +147,7 @@ def init_createcsv(default_location): if len(on) > 0: if on[0] == 'o': # create file at location & write KNOWN[0] to it warn('overwriting {}, all existing data in this file will be lost'.format(location)) - os.system('mkdir -p', os.path.dirname(location)) + os.makedirs(os.path.dirname(location), exist_ok=True) dotfm_csv = open(location, "w") for i, dfl in enumerate(KNOWN[0]): dotfm_csv.write(dfl if i == 0 else ',{}'.format(dfl)) @@ -156,15 +156,16 @@ def init_createcsv(default_location): elif on[0] == 'u': debug('using pre-existing csv {}'.format(location)) sys.exit() + # create default_location symlink if os.path.abspath(location) != os.path.abspath(default_location): debug('creating dotfm csv file symlink') - os.system('mkdir -p', os.path.dirname(default_location)) + os.makedirs(os.path.dirname(default_location), exist_ok=True) os.system('ln -isv', os.path.abspath(location), default_location) else: + os.makedirs(os.path.dirname(location), exist_ok=True) f = open(location, "w") f.close() - def init_loadcsv(location): dotfm_csv = open(location, "r") @@ -180,7 +181,7 @@ def install(dotfile): location = install_getlocation(known) aliases = install_getaliases(known) if not os.path.exists(os.path.dirname(location)): - os.system('mkdir -vp {}'.format(location)) + os.makedirs(os.path.dirname(locations), exist_ok=True) if os.path.lexists(location): install_oca(dotfile, location) os.system('ln -vs {} {}'.format(dotfile, location))