2022-09-07 05:54:31 -04:00
|
|
|
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
|
2024-06-17 06:03:26 -04:00
|
|
|
osc pwd
|
2022-09-07 05:54:31 -04:00
|
|
|
}
|