mirror of
https://github.com/tw93/Mole.git
synced 2026-03-23 23:50:07 +00:00
refactor(ui): unify action and list hints across commands
This commit is contained in:
@@ -56,9 +56,9 @@ manage_purge_paths() {
|
||||
for path in "${PURGE_SEARCH_PATHS[@]}"; do
|
||||
local display_path="${path/#$HOME/~}"
|
||||
if [[ -d "$path" ]]; then
|
||||
echo -e " ${GREEN}✓${NC} $display_path"
|
||||
echo -e " ${GREEN}${ICON_SUCCESS}${NC} $display_path"
|
||||
else
|
||||
echo -e " ${GRAY}○${NC} $display_path${GRAY}, not found${NC}"
|
||||
echo -e " ${GRAY}${ICON_EMPTY}${NC} $display_path${GRAY}, not found${NC}"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
@@ -25,7 +25,7 @@ format_brew_update_label() {
|
||||
printf '%s' "${details[*]}"
|
||||
)"
|
||||
fi
|
||||
printf " • Homebrew%s" "$detail_str"
|
||||
printf " %s Homebrew%s" "$ICON_LIST" "$detail_str"
|
||||
}
|
||||
|
||||
brew_has_outdated() {
|
||||
@@ -54,17 +54,17 @@ ask_for_updates() {
|
||||
|
||||
if [[ -n "${APPSTORE_UPDATE_COUNT:-}" && "${APPSTORE_UPDATE_COUNT:-0}" -gt 0 ]]; then
|
||||
has_updates=true
|
||||
update_list+=(" • App Store, ${APPSTORE_UPDATE_COUNT} apps")
|
||||
update_list+=(" ${ICON_LIST} App Store, ${APPSTORE_UPDATE_COUNT} apps")
|
||||
fi
|
||||
|
||||
if [[ -n "${MACOS_UPDATE_AVAILABLE:-}" && "${MACOS_UPDATE_AVAILABLE}" == "true" ]]; then
|
||||
has_updates=true
|
||||
update_list+=(" • macOS system")
|
||||
update_list+=(" ${ICON_LIST} macOS system")
|
||||
fi
|
||||
|
||||
if [[ -n "${MOLE_UPDATE_AVAILABLE:-}" && "${MOLE_UPDATE_AVAILABLE}" == "true" ]]; then
|
||||
has_updates=true
|
||||
update_list+=(" • Mole")
|
||||
update_list+=(" ${ICON_LIST} Mole")
|
||||
fi
|
||||
|
||||
if [[ "$has_updates" == "false" ]]; then
|
||||
@@ -96,7 +96,7 @@ ask_for_updates() {
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo -e "${YELLOW}💡 Run ${GREEN}brew upgrade${YELLOW} to update${NC}"
|
||||
echo -e "${ICON_REVIEW} Run ${GREEN}brew upgrade${NC} to update"
|
||||
|
||||
return 1
|
||||
}
|
||||
@@ -115,7 +115,7 @@ perform_updates() {
|
||||
|
||||
if [[ -x "$mole_bin" ]]; then
|
||||
if "$mole_bin" update 2>&1 | grep -qE "(Updated|latest version)"; then
|
||||
echo -e "${GREEN}✓${NC} Mole updated"
|
||||
echo -e "${GREEN}${ICON_SUCCESS}${NC} Mole updated"
|
||||
reset_mole_cache
|
||||
((updated_count++))
|
||||
else
|
||||
|
||||
@@ -562,9 +562,9 @@ batch_uninstall_applications() {
|
||||
# Show success
|
||||
if [[ -t 1 ]]; then
|
||||
if [[ ${#app_details[@]} -gt 1 ]]; then
|
||||
echo -e "${GREEN}✓${NC} [$current_index/${#app_details[@]}] ${app_name}"
|
||||
echo -e "${GREEN}${ICON_SUCCESS}${NC} [$current_index/${#app_details[@]}] ${app_name}"
|
||||
else
|
||||
echo -e "${GREEN}✓${NC} ${app_name}"
|
||||
echo -e "${GREEN}${ICON_SUCCESS}${NC} ${app_name}"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -582,7 +582,7 @@ batch_uninstall_applications() {
|
||||
echo -e "${ICON_ERROR} ${app_name} failed: $reason"
|
||||
fi
|
||||
if [[ -n "${suggestion:-}" ]]; then
|
||||
echo -e "${GRAY} → ${suggestion}${NC}"
|
||||
echo -e "${GRAY} ${ICON_REVIEW} ${suggestion}${NC}"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -662,7 +662,7 @@ batch_uninstall_applications() {
|
||||
# If suggestion is same as reason, there was no suggestion part
|
||||
# Also check if suggestion is empty
|
||||
if [[ "$first_suggestion" != "$first_reason" && -n "$first_suggestion" ]]; then
|
||||
suggestion_text="${GRAY} → ${first_suggestion}${NC}"
|
||||
suggestion_text="${GRAY}${ICON_REVIEW} ${first_suggestion}${NC}"
|
||||
fi
|
||||
|
||||
case "$first_reason" in
|
||||
@@ -673,7 +673,7 @@ batch_uninstall_applications() {
|
||||
*) reason_summary="$first_reason" ;;
|
||||
esac
|
||||
fi
|
||||
summary_details+=("Failed: ${RED}${failed_list}${NC} ${reason_summary}")
|
||||
summary_details+=("${ICON_LIST} Failed: ${RED}${failed_list}${NC} ${reason_summary}")
|
||||
if [[ -n "$suggestion_text" ]]; then
|
||||
summary_details+=("$suggestion_text")
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user