Compare commits

...

6 commits

Author SHA1 Message Date
42189dd171
cat,ls
All checks were successful
/ job (push) Successful in 1m13s
2024-06-04 19:18:32 +02:00
b8f5e00296
ln_py 2024-06-04 19:12:35 +02:00
768ebd4756
box,ls 2024-06-04 19:11:52 +02:00
1c45fd6ff6
box/right,up 2024-06-04 18:53:29 +02:00
461c798983
box/horizontal,vertical 2024-06-04 18:51:15 +02:00
2fa331302c
box/down,left 2024-06-04 18:46:38 +02:00

36
cd.sh
View file

@ -592,10 +592,18 @@ ${CD_GIT_CHILD}
# functions # functions
cd_box_open () {
echo "${CD_BOX_DOWN}${CD_BOX_LEFT} ${@}"
}
cd_box_shut () {
echo "${CD_BOX_UP}${CD_BOX_LEFT} ${@}"
}
cd_cat () { cd_cat () {
if [ "${1}" ] ; then if [ -f "${1}" ] ; then
echo "╭╴$(realpath "${1}")" cd_box_open "${1}"
cat "${1}" || exit cat "${1}" || exit
cd_box_shut "${1}"
fi fi
} }
@ -638,15 +646,16 @@ cd_install_package () {
cd_ln_python () { cd_ln_python () {
local command="${1}" local command="${1}"
if [ "${command}" ] ; then if [ "${command}" ] ; then
echo "${CD_PYTHON_ALIAS}${command}" echo "${CD_PYTHON_ALIAS}${command}"
ln -f -s "${command}" "/usr/bin/${CD_PYTHON_ALIAS}" || exit ln -f -s "${command}" "/usr/bin/${CD_PYTHON_ALIAS}" || exit
fi fi
} }
cd_ls () { cd_ls () {
if [ "${1}" ] ; then if [ -d "${1}" ] ; then
echo "╭╴$(realpath "${1}")" cd_box_open "${1}"
ls -a -l "${1}" || exit ls -a -l "${1}" || exit
cd_box_shut "${1}"
fi fi
} }
@ -688,16 +697,16 @@ shift
cd_split () { cd_split () {
echo -n "\ echo -n "\
${CD_SPLIT} ${CD_BOX_RIGHT}${CD_BOX_HORIZONTAL}
" "
} }
cd_step () { cd_step () {
CD_STEP=$((CD_STEP+1)) CD_STEP=$((CD_STEP+1))
echo -n "\ echo -n "\
${CD_SPLIT} ${CD_BOX_DOWN}${CD_BOX_HORIZONTAL}
${CD_STEP} ${@} ${CD_BOX_VERTICAL} ${CD_STEP} ${@}
${CD_SPLIT} ${CD_BOX_UP}${CD_BOX_HORIZONTAL}
" "
} }
@ -714,6 +723,13 @@ local text="${2}"
# constants # constants
CD_BOX_DOWN="╭"
CD_BOX_HORIZONTAL="─╌╌┄┄┈┈"
CD_BOX_LEFT="╴"
CD_BOX_RIGHT="╶"
CD_BOX_UP="╰"
CD_BOX_VERTICAL="│"
CD_ERROR_CI=2 CD_ERROR_CI=2
CD_ERROR_OS=1 CD_ERROR_OS=1
@ -730,7 +746,5 @@ CD_PM_APT="apt"
CD_PM_DNF="dnf" CD_PM_DNF="dnf"
CD_PM_PACMAN="pacman" CD_PM_PACMAN="pacman"
CD_SPLIT="─╌╌┄┄┈┈"
# run # run
cd_main "${@}" cd_main "${@}"