From ae10ee6cdc446804b85d1f3b0db7ef727f68af49 Mon Sep 17 00:00:00 2001 From: zen Date: Wed, 2 May 2018 15:46:55 +0930 Subject: [PATCH] Check if todo.sh already installed, correct path to it --- .zshrc | 5 +---- quickz.sh | 15 ++++++++++----- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.zshrc b/.zshrc index 82ce2fd..83a668c 100644 --- a/.zshrc +++ b/.zshrc @@ -118,10 +118,7 @@ export MARKER_KEY_NEXT_PLACEHOLDER="\C-b" #change maker key binding from Ctr+t [[ -s "$HOME/.local/share/marker/marker.sh" ]] && source "$HOME/.local/share/marker/marker.sh" -export PATH=$PATH:~/.todo/bin - -#alias todo.sh="~/.quickzsh/todo/todo.sh" -#complete -F _todo todo.sh #enable autocompletion for the alias, only needed if different alias +export PATH=$PATH:~/.quickzsh/todo/bin #usig alias doesn't properly work SAVEHIST=50000 #save upto 50,000 lines in history. oh-my-zsh default is 10,000 diff --git a/quickz.sh b/quickz.sh index b547f13..6ef2000 100755 --- a/quickz.sh +++ b/quickz.sh @@ -93,11 +93,16 @@ fi # mkdir ~/.quickzsh/todo/bin ; cp -f ~/.quickzsh/todo/todo.sh ~/.quickzsh/todo/bin/todo.sh # cp todo.sh to ./bin so only it is included in $PATH # #touch ~/.todo/config # needs it, otherwise spits error , yeah a bug in todo # ln -s ~/.quickzsh/todo ~/.todo -mkdir -p ~/.quickzsh/todo/bin -wget "https://github.com/todotxt/todo.txt-cli/releases/download/v2.11.0/todo.txt_cli-2.11.0.tar.gz" -P ~/.quickzsh/ -tar xvf ~/.quickzsh/todo.txt_cli-2.11.0.tar.gz -C ~/.quickzsh/todo --strip 1 && rm ~/.quickzsh/todo.txt_cli-2.11.0.tar.gz -ln -s ~/.quickzsh/todo/todo.sh ~/.quickzsh/todo/bin/todo.sh # so only .../bin is included in $PATH -ln -s ~/.quickzsh/todo/todo.cfg ~/.todo.cfg # it expects it there or ~/todo.cfg or ~/.todo/config +if [ ! -L ~/.quickzsh/todo/bin/todo.sh ]; then + echo -e "Installing todo.sh in ~/.quickzsh/todo\n" + mkdir -p ~/.quickzsh/todo/bin + wget "https://github.com/todotxt/todo.txt-cli/releases/download/v2.11.0/todo.txt_cli-2.11.0.tar.gz" -P ~/.quickzsh/ + tar xvf ~/.quickzsh/todo.txt_cli-2.11.0.tar.gz -C ~/.quickzsh/todo --strip 1 && rm ~/.quickzsh/todo.txt_cli-2.11.0.tar.gz + ln -s ~/.quickzsh/todo/todo.sh ~/.quickzsh/todo/bin/todo.sh # so only .../bin is included in $PATH + ln -s ~/.quickzsh/todo/todo.cfg ~/.todo.cfg # it expects it there or ~/todo.cfg or ~/.todo/config +else + echo -e "todo.sh is already instlled in ~/.quickzsh/todo\n" +fi if [[ $1 == "--cp-hist" ]]; then echo -e "\nCopying bash_history to zsh_history\n"