add argument presence check for functions in dirs plugin to bad usage

pull/433/head
Ivan Povalyukhin 2015-03-25 16:29:46 -07:00 committed by Ivan Povalyukhin
parent d6e6caf3c6
commit 0b300ccb86
1 changed files with 12 additions and 3 deletions

View File

@ -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;
}