diff --git a/plugins/available/dirs.plugin.bash b/plugins/available/dirs.plugin.bash index 4b82291c..283b51b0 100644 --- a/plugins/available/dirs.plugin.bash +++ b/plugins/available/dirs.plugin.bash @@ -67,7 +67,8 @@ fi alias L='cat ~/.dirs' -G () { # goes to distination dir otherwise , stay in the dir +# goes to distination dir otherwise, stay in the dir +G () { about 'goes to destination dir' param '1: directory' example '$ G ..' @@ -76,20 +77,28 @@ G () { # goes to distination dir otherwise , stay in the dir cd "${1:-$(pwd)}" ; } -S () { # SAVE a BOOKMARK +S () { about 'save a bookmark' + param '1: bookmark name' + example '$ S mybkmrk' group 'dirs' + [[ $# -eq 1 ]] || { echo "${FUNCNAME[0]} function requires 1 argument"; return 1; } + sed "/$@/d" ~/.dirs > ~/.dirs1; \mv ~/.dirs1 ~/.dirs; echo "$@"=\"`pwd`\" >> ~/.dirs; source ~/.dirs ; } -R () { # remove a BOOKMARK +R () { about 'remove a bookmark' + param '1: bookmark name' + example '$ R mybkmrk' group 'dirs' + [[ $# -eq 1 ]] || { echo "${FUNCNAME[0]} function requires 1 argument"; return 1; } + sed "/$@/d" ~/.dirs > ~/.dirs1; \mv ~/.dirs1 ~/.dirs; }