formatWindowTitle assembles the terminal window title string from the individual inputs that contribute to it. Pure function — extracted from the windowTitle method so that it can be unit-tested without constructing a full appModel.
(appName, sessionTitle string, working bool, animFrame int)
| 2653 | // windowTitle method so that it can be unit-tested without constructing a |
| 2654 | // full appModel. |
| 2655 | func formatWindowTitle(appName, sessionTitle string, working bool, animFrame int) string { |
| 2656 | title := appName |
| 2657 | if sessionTitle != "" { |
| 2658 | title = sessionTitle + " - " + appName |
| 2659 | } |
| 2660 | if working { |
| 2661 | title = spinner.Frame(animFrame) + " " + title |
| 2662 | } |
| 2663 | return title |
| 2664 | } |
| 2665 | |
| 2666 | // defaultExitFunc is the process-exit function used by the shutdown safety |
| 2667 | // net when the graceful exit times out. It is a package var (not a const) |