WaitForEnterToReturn displays a status message and waits for the user to press Enter before returning to the TUI. This provides a consistent experience across all suspend/resume operations.
(err error, successMsg, failureMsg string)
| 47 | // before returning to the TUI. This provides a consistent experience across all |
| 48 | // suspend/resume operations. |
| 49 | func WaitForEnterToReturn(err error, successMsg, failureMsg string) { |
| 50 | // Show completion status |
| 51 | if err != nil { |
| 52 | fmt.Printf("\n%s\n", display.IconText("❌", fmt.Sprintf("%s: %v", failureMsg, err), showIcons.Load())) |
| 53 | } else { |
| 54 | fmt.Printf("\n%s\n", display.IconText("✅", successMsg, showIcons.Load())) |
| 55 | } |
| 56 | |
| 57 | fmt.Print("\nPress Enter to return to the TUI...") |
| 58 | |
| 59 | if _, err := fmt.Scanln(); err != nil { |
| 60 | // Ignore scan errors as they're not critical for this function |
| 61 | // The user might have pressed Ctrl+C or similar |
| 62 | _ = err // Explicitly ignore the error to avoid empty branch |
| 63 | } |
| 64 | } |
no test coverage detected