switchProfile switches to a different profile
(profileName string)
| 724 | |
| 725 | // switchProfile switches to a different profile |
| 726 | func (m tuiModel) switchProfile(profileName string) tea.Cmd { |
| 727 | return func() tea.Msg { |
| 728 | // Load the selected profile |
| 729 | profile, err := cli.GetProfile(profileName) |
| 730 | if err != nil { |
| 731 | // Return error message |
| 732 | return profileSwitchErrorMsg{err: err} |
| 733 | } |
| 734 | |
| 735 | // Initialize new Hatchet client with the new profile's token |
| 736 | nopLogger := zerolog.Nop() |
| 737 | hatchetClient, err := NewClientFromProfile(profile, &nopLogger) |
| 738 | if err != nil { |
| 739 | return profileSwitchErrorMsg{err: err} |
| 740 | } |
| 741 | |
| 742 | return profileSwitchedMsg{ |
| 743 | profileName: profileName, |
| 744 | hatchetClient: hatchetClient, |
| 745 | } |
| 746 | } |
| 747 | } |
| 748 | |
| 749 | // renderQuitConfirmation renders the quit confirmation modal |
| 750 | func (m tuiModel) renderQuitConfirmation() string { |
no test coverage detected