From 3ff043798db843f5185d149a71b5daf643d5bfdf Mon Sep 17 00:00:00 2001 From: egurapha Date: Tue, 11 Feb 2025 22:31:24 -0500 Subject: [PATCH] simplified the printing in jump to parent --- .github/format.sh | 3 ++- src/functions.sh | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/format.sh b/.github/format.sh index 61d79df..705c682 100755 --- a/.github/format.sh +++ b/.github/format.sh @@ -1,3 +1,4 @@ #!/bin/bash -shfmt -w -i 4 -ci -s .. +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +shfmt -w -i 4 -ci -s -l "$SCRIPT_DIR/.." diff --git a/src/functions.sh b/src/functions.sh index d13df2a..a5455fd 100644 --- a/src/functions.sh +++ b/src/functions.sh @@ -200,7 +200,13 @@ function shunpo_jump_to_parent_dir() { # Display the current page of parent directories. for ((i = start_index; i < end_index; i++)); do - echo -e "[${SHUNPO_BOLD}${SHUNPO_ORANGE}$((i - start_index))${SHUNPO_RESET}] ${parent_dirs[i]}" + if [[ $i -eq $((end_index - 1)) && $current_page -eq $((last_page - 1)) ]]; then + echo -e "[${SHUNPO_BOLD}${SHUNPO_ORANGE}$((i - start_index))${SHUNPO_RESET}] $(basename ${parent_dirs[i]})" + elif [[ $i -eq $start_index && $current_page -eq 0 ]]; then + echo -e "[${SHUNPO_BOLD}${SHUNPO_ORANGE}$((i - start_index))${SHUNPO_RESET}] $(basename ${parent_dirs[i]})" + else + echo -e "[${SHUNPO_BOLD}${SHUNPO_ORANGE}$((i - start_index))${SHUNPO_RESET}] $(basename ${parent_dirs[i]})/" + fi done if [ $last_page -gt 1 ]; then