2019-11-16 07:38:38 +02:00
|
|
|
package gui
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"strings"
|
|
|
|
|
2021-07-27 15:00:37 +02:00
|
|
|
"github.com/jesseduffield/lazygit/pkg/gui/style"
|
2022-08-07 03:34:53 +02:00
|
|
|
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
2019-11-16 07:38:38 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
// list panel functions
|
|
|
|
|
2021-11-21 03:48:49 +02:00
|
|
|
func (gui *Gui) remotesRenderToMain() error {
|
2022-08-07 03:34:53 +02:00
|
|
|
var task types.UpdateTask
|
2022-02-05 08:04:10 +02:00
|
|
|
remote := gui.State.Contexts.Remotes.GetSelected()
|
2019-11-18 00:38:36 +02:00
|
|
|
if remote == nil {
|
2022-08-07 03:34:53 +02:00
|
|
|
task = types.NewRenderStringTask("No remotes")
|
2020-08-18 14:02:35 +02:00
|
|
|
} else {
|
2022-08-07 03:34:53 +02:00
|
|
|
task = types.NewRenderStringTask(fmt.Sprintf("%s\nUrls:\n%s", style.FgGreen.Sprint(remote.Name), strings.Join(remote.Urls, "\n")))
|
2020-03-29 05:34:17 +02:00
|
|
|
}
|
|
|
|
|
2022-08-07 03:34:53 +02:00
|
|
|
return gui.c.RenderToMainViews(types.RefreshMainOpts{
|
|
|
|
Pair: gui.c.MainViewPairs().Normal,
|
|
|
|
Main: &types.ViewUpdateOpts{
|
|
|
|
Title: "Remote",
|
|
|
|
Task: task,
|
2020-08-18 14:02:35 +02:00
|
|
|
},
|
|
|
|
})
|
2019-11-16 07:38:38 +02:00
|
|
|
}
|