From 2fa331302cb0ac4dde26337ec73ff008ec9b4016 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 4 Jun 2024 18:46:38 +0200 Subject: [PATCH 1/6] box/down,left --- cd.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cd.sh b/cd.sh index e46fdb5..c8169cb 100644 --- a/cd.sh +++ b/cd.sh @@ -594,7 +594,7 @@ ${CD_GIT_CHILD} cd_cat () { if [ "${1}" ] ; then - echo "╭╴$(realpath "${1}")" + echo "${CD_BOX_DOWN}${CD_BOX_LEFT}$(realpath "${1}")" cat "${1}" || exit fi } @@ -645,7 +645,7 @@ local command="${1}" cd_ls () { if [ "${1}" ] ; then - echo "╭╴$(realpath "${1}")" + echo "${CD_BOX_DOWN}${CD_BOX_LEFT}$(realpath "${1}")" ls -a -l "${1}" || exit fi } @@ -695,7 +695,7 @@ cd_split () { cd_step () { CD_STEP=$((CD_STEP+1)) echo -n "\ -╭${CD_SPLIT} +${CD_BOX_DOWN}${CD_SPLIT} │ ${CD_STEP} ${@} ╰${CD_SPLIT} " @@ -714,6 +714,9 @@ local text="${2}" # constants +CD_BOX_DOWN="╭" +CD_BOX_LEFT="╴" + CD_ERROR_CI=2 CD_ERROR_OS=1 From 461c798983ab0f4f79784cb1b1b2dcab96beb917 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 4 Jun 2024 18:51:15 +0200 Subject: [PATCH 2/6] box/horizontal,vertical --- cd.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cd.sh b/cd.sh index c8169cb..f67399d 100644 --- a/cd.sh +++ b/cd.sh @@ -688,16 +688,16 @@ shift cd_split () { echo -n "\ -╶${CD_SPLIT} +╶${CD_BOX_HORIZONTAL} " } cd_step () { CD_STEP=$((CD_STEP+1)) echo -n "\ -${CD_BOX_DOWN}${CD_SPLIT} -│ ${CD_STEP} ${@} -╰${CD_SPLIT} +${CD_BOX_DOWN}${CD_BOX_HORIZONTAL} +${CD_BOX_VERTICAL} ${CD_STEP} ${@} +╰${CD_BOX_HORIZONTAL} " } @@ -715,7 +715,9 @@ local text="${2}" # constants CD_BOX_DOWN="╭" +CD_BOX_HORIZONTAL="─╌╌┄┄┈┈" CD_BOX_LEFT="╴" +CD_BOX_VERTICAL="│" CD_ERROR_CI=2 CD_ERROR_OS=1 @@ -733,7 +735,5 @@ CD_PM_APT="apt" CD_PM_DNF="dnf" CD_PM_PACMAN="pacman" -CD_SPLIT="─╌╌┄┄┈┈" - # run cd_main "${@}" From 1c45fd6ff65c756059e04a73c7dd0c7828c42052 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 4 Jun 2024 18:53:29 +0200 Subject: [PATCH 3/6] box/right,up --- cd.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cd.sh b/cd.sh index f67399d..3feee96 100644 --- a/cd.sh +++ b/cd.sh @@ -688,7 +688,7 @@ shift cd_split () { echo -n "\ -╶${CD_BOX_HORIZONTAL} +${CD_BOX_RIGHT}${CD_BOX_HORIZONTAL} " } @@ -697,7 +697,7 @@ cd_step () { echo -n "\ ${CD_BOX_DOWN}${CD_BOX_HORIZONTAL} ${CD_BOX_VERTICAL} ${CD_STEP} ${@} -╰${CD_BOX_HORIZONTAL} +${CD_BOX_UP}${CD_BOX_HORIZONTAL} " } @@ -717,6 +717,8 @@ local text="${2}" CD_BOX_DOWN="╭" CD_BOX_HORIZONTAL="─╌╌┄┄┈┈" CD_BOX_LEFT="╴" +CD_BOX_RIGHT="╶" +CD_BOX_UP="╰" CD_BOX_VERTICAL="│" CD_ERROR_CI=2 From 768ebd47566d0ca12ae1e72de4ab0eb2c8b9ab9e Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 4 Jun 2024 19:11:52 +0200 Subject: [PATCH 4/6] box,ls --- cd.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/cd.sh b/cd.sh index 3feee96..c5768e7 100644 --- a/cd.sh +++ b/cd.sh @@ -592,6 +592,16 @@ ${CD_GIT_CHILD} # functions +cd_box_more () { + echo "${CD_BOX_VERTICAL} ${@}" +} +cd_box_open () { + echo "${CD_BOX_DOWN}${CD_BOX_LEFT} ${@}" +} +cd_box_shut () { + echo "${CD_BOX_UP}${CD_BOX_LEFT} ${@}" +} + cd_cat () { if [ "${1}" ] ; then echo "${CD_BOX_DOWN}${CD_BOX_LEFT}$(realpath "${1}")" @@ -644,9 +654,12 @@ local command="${1}" } cd_ls () { - if [ "${1}" ] ; then - echo "${CD_BOX_DOWN}${CD_BOX_LEFT}$(realpath "${1}")" +local path + if [ -d "${1}" ] ; then + path="$(realpath "${1}")" + cd_box_open "${split}" ls -a -l "${1}" || exit + cd_box_shut "${split}" fi } From b8f5e00296f6b268e0b035307027d56a2126b46f Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 4 Jun 2024 19:12:35 +0200 Subject: [PATCH 5/6] ln_py --- cd.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cd.sh b/cd.sh index c5768e7..b9a54ac 100644 --- a/cd.sh +++ b/cd.sh @@ -648,7 +648,7 @@ cd_install_package () { cd_ln_python () { local command="${1}" if [ "${command}" ] ; then - echo "${CD_PYTHON_ALIAS} → ${command}" + echo "→ ${CD_PYTHON_ALIAS} → ${command}" ln -f -s "${command}" "/usr/bin/${CD_PYTHON_ALIAS}" || exit fi } From 42189dd17110fa5ebcdb743d3a450c1be8b53b84 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 4 Jun 2024 19:18:32 +0200 Subject: [PATCH 6/6] cat,ls --- cd.sh | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/cd.sh b/cd.sh index b9a54ac..b7b74cb 100644 --- a/cd.sh +++ b/cd.sh @@ -592,9 +592,6 @@ ${CD_GIT_CHILD} # functions -cd_box_more () { - echo "${CD_BOX_VERTICAL} ${@}" -} cd_box_open () { echo "${CD_BOX_DOWN}${CD_BOX_LEFT} ${@}" } @@ -603,9 +600,10 @@ cd_box_shut () { } cd_cat () { - if [ "${1}" ] ; then - echo "${CD_BOX_DOWN}${CD_BOX_LEFT}$(realpath "${1}")" + if [ -f "${1}" ] ; then + cd_box_open "${1}" cat "${1}" || exit + cd_box_shut "${1}" fi } @@ -654,12 +652,10 @@ local command="${1}" } cd_ls () { -local path if [ -d "${1}" ] ; then - path="$(realpath "${1}")" - cd_box_open "${split}" + cd_box_open "${1}" ls -a -l "${1}" || exit - cd_box_shut "${split}" + cd_box_shut "${1}" fi }