Merge pull request #433 from ipoval/add_argument_presence_check_for_dirs_plugin_functions

add argument presence check for functions in dirs plugin to bad usage
pull/437/head
Nils Winkler 2015-03-26 19:21:49 +01:00
commit da07182910
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;
}