MCPcopy
hub / github.com/hatchet-dev/hatchet / switchProfile

Method switchProfile

cmd/hatchet-cli/cli/tui.go:726–747  ·  view source on GitHub ↗

switchProfile switches to a different profile

(profileName string)

Source from the content-addressed store, hash-verified

724
725// switchProfile switches to a different profile
726func (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
750func (m tuiModel) renderQuitConfirmation() string {

Callers 1

UpdateMethod · 0.95

Calls 2

GetProfileFunction · 0.92
NewClientFromProfileFunction · 0.85

Tested by

no test coverage detected