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 usagepull/437/head
commit
da07182910
|
|
@ -67,7 +67,8 @@ fi
|
||||||
|
|
||||||
alias L='cat ~/.dirs'
|
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'
|
about 'goes to destination dir'
|
||||||
param '1: directory'
|
param '1: directory'
|
||||||
example '$ G ..'
|
example '$ G ..'
|
||||||
|
|
@ -76,20 +77,28 @@ G () { # goes to distination dir otherwise , stay in the dir
|
||||||
cd "${1:-$(pwd)}" ;
|
cd "${1:-$(pwd)}" ;
|
||||||
}
|
}
|
||||||
|
|
||||||
S () { # SAVE a BOOKMARK
|
S () {
|
||||||
about 'save a bookmark'
|
about 'save a bookmark'
|
||||||
|
param '1: bookmark name'
|
||||||
|
example '$ S mybkmrk'
|
||||||
group 'dirs'
|
group 'dirs'
|
||||||
|
|
||||||
|
[[ $# -eq 1 ]] || { echo "${FUNCNAME[0]} function requires 1 argument"; return 1; }
|
||||||
|
|
||||||
sed "/$@/d" ~/.dirs > ~/.dirs1;
|
sed "/$@/d" ~/.dirs > ~/.dirs1;
|
||||||
\mv ~/.dirs1 ~/.dirs;
|
\mv ~/.dirs1 ~/.dirs;
|
||||||
echo "$@"=\"`pwd`\" >> ~/.dirs;
|
echo "$@"=\"`pwd`\" >> ~/.dirs;
|
||||||
source ~/.dirs ;
|
source ~/.dirs ;
|
||||||
}
|
}
|
||||||
|
|
||||||
R () { # remove a BOOKMARK
|
R () {
|
||||||
about 'remove a bookmark'
|
about 'remove a bookmark'
|
||||||
|
param '1: bookmark name'
|
||||||
|
example '$ R mybkmrk'
|
||||||
group 'dirs'
|
group 'dirs'
|
||||||
|
|
||||||
|
[[ $# -eq 1 ]] || { echo "${FUNCNAME[0]} function requires 1 argument"; return 1; }
|
||||||
|
|
||||||
sed "/$@/d" ~/.dirs > ~/.dirs1;
|
sed "/$@/d" ~/.dirs > ~/.dirs1;
|
||||||
\mv ~/.dirs1 ~/.dirs;
|
\mv ~/.dirs1 ~/.dirs;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue