diff options
author | Markus Færevaag <mf@bitblueprint.com> | 2013-11-26 00:45:24 +0100 |
---|---|---|
committer | Markus Færevaag <mf@bitblueprint.com> | 2013-11-26 00:45:24 +0100 |
commit | 240b25daaaee81ccdb9e6e2016667a60f5241f83 (patch) | |
tree | c940fbd509bb719475f34bf6922c2cd8a996f9b1 | |
parent | 6f48f586ba55507bb90fa8dd078b01c0333b907d (diff) | |
download | zsh-240b25daaaee81ccdb9e6e2016667a60f5241f83.tar.gz zsh-240b25daaaee81ccdb9e6e2016667a60f5241f83.tar.bz2 zsh-240b25daaaee81ccdb9e6e2016667a60f5241f83.zip |
wd.plugin: Fixed nested dirs
-rwxr-xr-x | plugins/wd/wd.plugin.zsh (renamed from plugins/wd2/wd2/wd.plugin.zsh) | 2 | ||||
-rwxr-xr-x | plugins/wd/wd.sh (renamed from plugins/wd2/wd2/wd.sh) | 23 |
2 files changed, 20 insertions, 5 deletions
diff --git a/plugins/wd2/wd2/wd.plugin.zsh b/plugins/wd/wd.plugin.zsh index e0846ffd9..bbec4a715 100755 --- a/plugins/wd2/wd2/wd.plugin.zsh +++ b/plugins/wd/wd.plugin.zsh @@ -6,4 +6,4 @@ # # @github.com/mfaerevaag/wd -alias wd='. ~/.oh-my-zsh/plugins/wd/wd.sh' +alias wd='. $ZSH/plugins/wd/wd.sh' diff --git a/plugins/wd2/wd2/wd.sh b/plugins/wd/wd.sh index 7852028c0..744f58bc2 100755 --- a/plugins/wd2/wd2/wd.sh +++ b/plugins/wd/wd.sh @@ -19,6 +19,13 @@ RED="\033[91m" NOC="\033[m" +# check if config file exists +if [[ ! -a $CONFIG ]] +then + # if not: create config file + touch $CONFIG +fi + ## load warp points typeset -A points while read line @@ -120,11 +127,12 @@ wd_print_msg() wd_print_usage() { - print "Usage: wd [add|-a|--add] [rm|-r|--remove] [ls|-l|--list] <point>" + print "Usage: wd [add|-a|--add] [rm|-r|--remove] [ls|-l|--list] <point>" print "\nCommands:" print "\t add \t Adds the current working directory to your warp points" print "\t add! \t Overwrites existing warp point" print "\t remove Removes the given warp point" + print "\t show \t Outputs warp points to current directory" print "\t list \t Outputs all stored warp points" print "\t help \t Show this extremely helpful text" } @@ -135,13 +143,20 @@ wd_print_usage() # get opts args=`getopt -o a:r:lhs -l add:,remove:,list,help,show -- $*` +# check if no arguments were given if [[ $? -ne 0 || $#* -eq 0 ]] then wd_print_usage -else - # can't exit, as this would exit the excecuting shell - # e.i. your terminal +# check if config file is writeable +elif [[ ! -w $CONFIG ]] +then + wd_print_msg $RED "\'$CONFIG\' is not writeable." + # do nothing => exit + # can't run `exit`, as this would exit the executing shell + # i.e. your terminal + +else #set -- $args # WTF for i |