From eb08b5e32a907a6d17b25efa7295b63fb4355f91 Mon Sep 17 00:00:00 2001 From: ixc7 Date: Fri, 5 Jan 2024 03:32:59 -0500 Subject: [PATCH] color pathnames by type --- ui.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ui.sh b/ui.sh index 50e1863..66970e8 100644 --- a/ui.sh +++ b/ui.sh @@ -187,13 +187,26 @@ _viewFileTree() { declare -a urlNames="(${urlNamesJSON})" declare -a pathNames="(${pathNamesJSON})" + # TODO + declare -a coloredPathNames=($(echo "${*}" | jq -r ' + .tree[] | + if .type == "tree" then + "\\x1b[1m" + "\\x1b[38;5;81m" + .path + "/" + "\\x1b[0m" + elif .type == "blob" then + "\\x1b[1m" + "\\x1b[38;5;163m" + .path + "\\x1b[0m" + else + empty + end + ')) + # repo is empty [[ ${#pathNames[@]} -eq 0 ]] && return 1 # browse files while true; do + # _viewMultiplePages "${coloredPathNames[@]}" -o "${outfile}" && _viewMultiplePages "${pathNames[@]}" -o "${outfile}" && - selection=$(cat "${outfile}" | tr '\\' ' ') # un escape spaces + selection=$(echo -e $(cat "${outfile}" | tr '\\' ' ')) # un escape spaces # quit [[ "${#selection}" -eq 0 ]] && break