mirror of
https://github.com/tw93/Mole.git
synced 2026-03-24 03:15:06 +00:00
refactor(ui): unify action and list hints across commands
This commit is contained in:
38
mole
38
mole
@@ -242,8 +242,8 @@ update_mole() {
|
||||
if is_homebrew_install; then
|
||||
if [[ "$nightly_update" == "true" ]]; then
|
||||
log_error "Nightly update is only available for script installations"
|
||||
echo -e "${YELLOW}Tip:${NC} Homebrew installs follow stable releases."
|
||||
echo -e "${YELLOW}Tip:${NC} Reinstall via script to use: ${GRAY}mo update --nightly${NC}"
|
||||
echo -e "${ICON_REVIEW} Homebrew installs follow stable releases."
|
||||
echo -e "${ICON_REVIEW} Reinstall via script to use: ${GRAY}mo update --nightly${NC}"
|
||||
exit 1
|
||||
fi
|
||||
update_via_homebrew "$VERSION"
|
||||
@@ -266,8 +266,8 @@ update_mole() {
|
||||
|
||||
if [[ -z "$latest" ]]; then
|
||||
log_error "Unable to check for updates. Check network connection."
|
||||
echo -e "${YELLOW}Tip:${NC} Check if you can access GitHub, https://github.com"
|
||||
echo -e "${YELLOW}Tip:${NC} Try again with: ${GRAY}mo update${NC}"
|
||||
echo -e "${ICON_REVIEW} Check if you can access GitHub, https://github.com"
|
||||
echo -e "${ICON_REVIEW} Try again with: ${GRAY}mo update${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -301,13 +301,13 @@ update_mole() {
|
||||
log_error "Update failed, curl error: $curl_exit"
|
||||
|
||||
case $curl_exit in
|
||||
6) echo -e "${YELLOW}Tip:${NC} Could not resolve host. Check DNS or network connection." ;;
|
||||
7) echo -e "${YELLOW}Tip:${NC} Failed to connect. Check network or proxy settings." ;;
|
||||
22) echo -e "${YELLOW}Tip:${NC} HTTP 404 Not Found. The installer may have moved." ;;
|
||||
28) echo -e "${YELLOW}Tip:${NC} Connection timed out. Try again or check firewall." ;;
|
||||
*) echo -e "${YELLOW}Tip:${NC} Check network connection and try again." ;;
|
||||
6) echo -e "${ICON_REVIEW} Could not resolve host. Check DNS or network connection." ;;
|
||||
7) echo -e "${ICON_REVIEW} Failed to connect. Check network or proxy settings." ;;
|
||||
22) echo -e "${ICON_REVIEW} HTTP 404 Not Found. The installer may have moved." ;;
|
||||
28) echo -e "${ICON_REVIEW} Connection timed out. Try again or check firewall." ;;
|
||||
*) echo -e "${ICON_REVIEW} Check network connection and try again." ;;
|
||||
esac
|
||||
echo -e "${YELLOW}Tip:${NC} URL: $installer_url"
|
||||
echo -e "${ICON_REVIEW} URL: $installer_url"
|
||||
exit 1
|
||||
}
|
||||
elif command -v wget > /dev/null 2>&1; then
|
||||
@@ -315,15 +315,15 @@ update_mole() {
|
||||
if [[ -t 1 ]]; then stop_inline_spinner; fi
|
||||
rm -f "$tmp_installer"
|
||||
log_error "Update failed, wget error"
|
||||
echo -e "${YELLOW}Tip:${NC} Check network connection and try again."
|
||||
echo -e "${YELLOW}Tip:${NC} URL: $installer_url"
|
||||
echo -e "${ICON_REVIEW} Check network connection and try again."
|
||||
echo -e "${ICON_REVIEW} URL: $installer_url"
|
||||
exit 1
|
||||
}
|
||||
else
|
||||
if [[ -t 1 ]]; then stop_inline_spinner; fi
|
||||
rm -f "$tmp_installer"
|
||||
log_error "curl or wget required"
|
||||
echo -e "${YELLOW}Tip:${NC} Install curl with: ${GRAY}brew install curl${NC}"
|
||||
echo -e "${ICON_REVIEW} Install curl with: ${GRAY}brew install curl${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -520,13 +520,13 @@ remove_mole() {
|
||||
|
||||
echo -e "${YELLOW}Remove Mole${NC}, will delete the following:"
|
||||
if [[ "$is_homebrew" == "true" ]]; then
|
||||
echo " * Mole via Homebrew"
|
||||
echo " ${ICON_LIST} Mole via Homebrew"
|
||||
fi
|
||||
for install in ${manual_installs[@]+"${manual_installs[@]}"} ${alias_installs[@]+"${alias_installs[@]}"}; do
|
||||
echo " * $install"
|
||||
echo " ${ICON_LIST} $install"
|
||||
done
|
||||
echo " * ~/.config/mole"
|
||||
echo " * ~/.cache/mole"
|
||||
echo " ${ICON_LIST} ~/.config/mole"
|
||||
echo " ${ICON_LIST} ~/.cache/mole"
|
||||
echo -ne "${PURPLE}${ICON_ARROW}${NC} Press ${GREEN}Enter${NC} to confirm, ${GRAY}ESC${NC} to cancel: "
|
||||
|
||||
IFS= read -r -s -n1 key || key=""
|
||||
@@ -547,7 +547,7 @@ remove_mole() {
|
||||
if [[ "$is_homebrew" == "true" ]]; then
|
||||
if [[ -z "$brew_cmd" ]]; then
|
||||
log_error "Homebrew command not found. Please ensure Homebrew is installed and in your PATH."
|
||||
log_warning "You may need to manually run: brew uninstall --force mole"
|
||||
log_warning "Manual step: brew uninstall --force mole"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -557,7 +557,7 @@ remove_mole() {
|
||||
has_error=true
|
||||
log_error "Homebrew uninstallation failed:"
|
||||
printf "%s\n" "$brew_uninstall_output" | sed "s/^/${RED} | ${NC}/" >&2
|
||||
log_warning "Please manually run: ${YELLOW}brew uninstall --force mole${NC}"
|
||||
log_warning "Manual step: ${YELLOW}brew uninstall --force mole${NC}"
|
||||
echo "" # Add a blank line for readability
|
||||
else
|
||||
log_success "Mole uninstalled via Homebrew."
|
||||
|
||||
Reference in New Issue
Block a user