mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-19 21:41:07 +01:00
wd.plugin: Fixed nested dirs
This commit is contained in:
parent
6f48f586ba
commit
240b25daaa
2 changed files with 20 additions and 5 deletions
|
@ -6,4 +6,4 @@
|
||||||
#
|
#
|
||||||
# @github.com/mfaerevaag/wd
|
# @github.com/mfaerevaag/wd
|
||||||
|
|
||||||
alias wd='. ~/.oh-my-zsh/plugins/wd/wd.sh'
|
alias wd='. $ZSH/plugins/wd/wd.sh'
|
|
@ -19,6 +19,13 @@ RED="\033[91m"
|
||||||
NOC="\033[m"
|
NOC="\033[m"
|
||||||
|
|
||||||
|
|
||||||
|
# check if config file exists
|
||||||
|
if [[ ! -a $CONFIG ]]
|
||||||
|
then
|
||||||
|
# if not: create config file
|
||||||
|
touch $CONFIG
|
||||||
|
fi
|
||||||
|
|
||||||
## load warp points
|
## load warp points
|
||||||
typeset -A points
|
typeset -A points
|
||||||
while read line
|
while read line
|
||||||
|
@ -125,6 +132,7 @@ wd_print_usage()
|
||||||
print "\t add \t Adds the current working directory to your warp points"
|
print "\t add \t Adds the current working directory to your warp points"
|
||||||
print "\t add! \t Overwrites existing warp point"
|
print "\t add! \t Overwrites existing warp point"
|
||||||
print "\t remove Removes the given 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 list \t Outputs all stored warp points"
|
||||||
print "\t help \t Show this extremely helpful text"
|
print "\t help \t Show this extremely helpful text"
|
||||||
}
|
}
|
||||||
|
@ -135,13 +143,20 @@ wd_print_usage()
|
||||||
# get opts
|
# get opts
|
||||||
args=`getopt -o a:r:lhs -l add:,remove:,list,help,show -- $*`
|
args=`getopt -o a:r:lhs -l add:,remove:,list,help,show -- $*`
|
||||||
|
|
||||||
|
# check if no arguments were given
|
||||||
if [[ $? -ne 0 || $#* -eq 0 ]]
|
if [[ $? -ne 0 || $#* -eq 0 ]]
|
||||||
then
|
then
|
||||||
wd_print_usage
|
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
|
#set -- $args # WTF
|
||||||
|
|
||||||
for i
|
for i
|
Loading…
Reference in a new issue