commit 374568dec9585bd019a90e689c318bbf17be0101 parent d88099cb5c638a53bd056bf8801493dcd652c527 Author: gearsix <gearsix@tuta.io> Date: Wed, 21 Apr 2021 21:56:36 +0100 added prompt for install location of recognised dotfiles Diffstat:
M | src/dotfm.py | | | 14 | +++++++++++++- |
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/dotfm.py b/src/dotfm.py @@ -188,8 +188,20 @@ def dotfm_install(dotfile_source): # compare dotfile base file name if os.path.basename(dotfile_source) == alias: found = True - # make sure dotfile dir exists + # double-check the user wants it installed to the default location + inp = '' dest = os.path.abspath(dfl[0]) + while inp == '': + inp = input('install location (default: {}) '.format(dest)) + if len(inp) == 0: + inp = dest + else: + print(inp) + if inp.find('~') != -1: + inp = inp.replace('~', HOME) + print(inp) + dest = inp + # make sure dotfile dir exists if not os.path.exists(os.path.dirname(dest)): os.system('mkdir -vp {}'.format(dest)) # check if file already exists and prompt for action if it does