Skip to content

Commit

Permalink
Merge pull request #16 from egurapha/simplified-sj
Browse files Browse the repository at this point in the history
Simplified the printing in jump to parent
  • Loading branch information
egurapha authored Feb 12, 2025
2 parents e7ccb8f + 3ff0437 commit 25426d7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .github/format.sh
Original file line number Diff line number Diff line change
@@ -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/.."
8 changes: 7 additions & 1 deletion src/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 25426d7

Please sign in to comment.