jmod - quick jump to a module
This commit is contained in:
parent
8e49bcb05d
commit
e57032ae8b
26
jmod
Normal file
26
jmod
Normal file
@ -0,0 +1,26 @@
|
||||
function jmod
|
||||
{
|
||||
typeset dir root sel
|
||||
typeset -a dirs names
|
||||
typeset -i i=0
|
||||
|
||||
(( $# != 1 )) && return 64
|
||||
root=$(jr && pwd)/modules/apps
|
||||
set -A dirs $(find $root -maxdepth 2 -mindepth 2 -type d -iregex ".*/[^/]*$1[^/]*" | sort)
|
||||
(( ${#dirs[@]} == 0 )) && return 1
|
||||
for dir in ${dirs[@]}
|
||||
do
|
||||
names[$i]=${dir##*/}
|
||||
let i++
|
||||
done
|
||||
if (( ${#names[@]} > 1 ))
|
||||
then
|
||||
select sel in ${names[@]}
|
||||
do
|
||||
print ${sel} && cd ${dirs[(( REPLY - 1 ))]}
|
||||
break;
|
||||
done
|
||||
else
|
||||
print ${names[0]} && cd ${dirs[0]}
|
||||
fi
|
||||
}
|
Loading…
Reference in New Issue
Block a user