Skip to content

Commit 4990935

Browse files
committed
Update icons and visuals. Add new hs function link to link into HHS_DIR/bin folder
1 parent 19e4b22 commit 4990935

File tree

5 files changed

+67
-9
lines changed

5 files changed

+67
-9
lines changed

assets/hhs-icons.csv

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,10 @@ Icon,Hex,Oct,Name,Bash
2525
,F07B,\xef\x81\xbb,Folder Closed,No
2626
,F1FA,\xef\x87\xba,At,No
2727
,F415,\xef\x90\x95,User,No
28+
,F071,\xef\x81\xb1,Warning,No
29+
,F114,\xef\x84\x94,Folder-o,No
30+
,F482,\xef\x92\x82,Link,No
31+
,F482,\xef\x92\x82,Folder-Link,No
32+
,F29C,\xef\x8a\x9c,Unknown,No
33+
,F176,\xef\x85\xb6,Status-Up,No
34+
,F175,\xef\x85\xb5,Status-Down,No

bin/apps/bash/hhs-app/functions/term.bash

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,52 @@ function sheets() {
127127

128128
return 1
129129
}
130+
131+
# @purpose: Create symbolic links of HomeSetup scripts into HHS_DIR/bin folder.
132+
# @param $1..$N : Source files/dirs to be linked.
133+
function link() {
134+
local -a src bash_sources=() next dest
135+
136+
read -r -a src <<< "${*}"
137+
138+
[[ "${#src[@]}" -eq 0 || -z "${HHS_DIR}" || $1 =~ -h|--help ]] &&
139+
quit 1 "usage: ${FUNCNAME[0]} <files/dirs...>"
140+
141+
echo -e "${BLUE}Creating symbolic links of HomeSetup scripts into '${HHS_DIR}/bin' folder...${NC}"
142+
143+
while read -r next; do
144+
if [[ -d "${next}" ]]; then
145+
echo -e "${BLUE} Processing directory: '${next}'...${NC}"
146+
while IFS= read -r f; do
147+
bash_sources+=("$(pwd)/$f")
148+
done < <(find "${next}" -type f \( -name '*.sh' -o -name '*.bash' -o -name '*.zsh' \))
149+
continue
150+
elif [[ ! -f "${next}" ]]; then
151+
echo -e "${YELLOW} Warning: '${next}' is not a valid file or directory. Skipping...${NC}"
152+
continue
153+
fi
154+
echo -e "${BLUE} Processing file: '${next}'...${NC}"
155+
bash_sources+=("$(pwd)/${next}")
156+
done < <(printf '%s\n' "${src[@]}")
157+
158+
echo -e "${BLUE}Total files to be linked: ${#bash_sources[@]}\n"
159+
160+
for next in "${bash_sources[@]}"; do
161+
dest="${HHS_DIR}/bin/$(basename "${next}")"
162+
163+
if [[ -e "${dest}" || -L "${dest}" ]]; then
164+
echo -e "${YELLOW} Warning: '${dest}' already exists. It will be replaced.${NC}"
165+
\rm -f "${dest}" || quit 4 "Failed to remove '${dest}'"
166+
elif [[ -f "${dest}" ]]; then
167+
quit 2 "Destination '${dest}' already exists and is not a symlink!"
168+
fi
169+
170+
if \ln -sf "${next}" "${HHS_DIR}/bin"; then
171+
echo -e "${GREEN}Symlink created: '${next}'  '${dest}'${NC}"
172+
else
173+
quit 2 "Failed to symlink '${next}'"
174+
fi
175+
done
176+
177+
quit 0
178+
}

bin/apps/bash/hhs-app/plugins/services/services.bash

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,21 +159,21 @@ function list_services_status() {
159159
[[ ${#service} -gt ${longest} ]] && longest=${#service}
160160
done
161161

162-
printf -v dash_pad '%*s' $((width + 2 + longest + 10)) ''
162+
printf -v dash_pad ' %*s ' $((width + 2 + longest + 10)) ''
163163
dash_pad=${dash_pad// /-}
164-
printf "%b\n%b\n" "${WHITE}Service$(printf '%*s' 13 ' ')Status${NC}" "${dash_pad}"
164+
printf " %b\n%b\n" "${WHITE}Service$(printf '%*s' 13 ' ')Status${NC}" "${dash_pad}"
165165

166166
i=1
167167
for line in "${raw_services[@]}"; do
168168
service="${line%%:*}"
169169
status="${line##*:}"
170170
[[ -n "${filter}" && ! "${service,,}" =~ ${filter,,} ]] && continue
171-
printf -v service_entry "%${width}d. %s" "${i}" "${service}"
171+
printf -v service_entry "%${width}d: %s" "${i}" "${service}"
172172
while [[ ${#service_entry} -lt $((width + 2 + longest + 3)) ]]; do service_entry+="."; done
173173
((i++))
174174
[[ "${status}" =~ ^(started|running|enabled|active)$ ]] &&
175-
{ printf "%b %b\n" "${HHS_HIGHLIGHT_COLOR}${service_entry}${NC}" "${GREEN} Up${NC}"; continue; }
176-
printf "%b %b\n" "${HHS_HIGHLIGHT_COLOR}${service_entry}${NC}" "${RED} Down${NC}"
175+
{ printf " %b %b\n" "${HHS_HIGHLIGHT_COLOR}${service_entry}${NC}" "${GREEN} Up${NC}"; continue; }
176+
printf " %b %b\n" "${HHS_HIGHLIGHT_COLOR}${service_entry}${NC}" "${RED} Down${NC}"
177177
done
178178
}
179179

bin/hhs-functions/bash/hhs-paths.bash

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,9 @@ function __hhs_paths() {
153153

154154
# Determine prefix icon
155155
if [[ -L "${path_raw}" ]]; then
156-
type_prefix=" "
156+
type_prefix=" "
157157
elif [[ -d "${path_raw}" ]]; then
158158
type_prefix=""
159-
elif [[ -f "${path_raw}" ]]; then
160-
type_prefix=""
161159
else
162160
type_prefix=""
163161
fi

dotfiles/bash/bash_icons.bash

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,9 @@ else
4343
STAR_ICN="\xef\x80\x85" #
4444
SUCCESS_ICN="\xef\x98\xab" #
4545
TIP_ICON="\xef\x90\x80" #
46-
46+
WARN_ICON="\xef\x81\xb1" #
47+
FOLDER_ICON="\xef\x84\x94" #
48+
UNKNOWN_ICON="\xef\x8a\x9c" #
49+
LINK_ICON="\xef\x92\x82" #
50+
FOLDER_LINK_ICON="\xef\x92\x82" #
4751
fi

0 commit comments

Comments
 (0)