GetStatusEmoji returns the appropriate status emoji or text based on showIcons flag.
(status string, showIcons bool)
| 132 | |
| 133 | // GetStatusEmoji returns the appropriate status emoji or text based on showIcons flag. |
| 134 | func GetStatusEmoji(status string, showIcons bool) string { |
| 135 | if !showIcons { |
| 136 | return "" |
| 137 | } |
| 138 | |
| 139 | switch strings.ToLower(status) { |
| 140 | case statusRunning, statusOnline: |
| 141 | return "🟢" |
| 142 | case statusStopped, statusOffline: |
| 143 | return "🔴" |
| 144 | default: |
| 145 | return "🟡" |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | // CalculatePercentage safely calculates percentage from used and total values |
| 150 | // Returns 0.0 if total is 0 to avoid division by zero. |