summaryrefslogtreecommitdiffstats
path: root/pkg/gui/controllers/tags_controller.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2022-12-30 23:24:24 +1100
committerJesse Duffield <jessedduffield@gmail.com>2023-04-30 13:19:52 +1000
commit8edad826caf2fa48bfad33f9f8c4f3ba49a052da (patch)
tree0b49145e4f656e72441199b5a5c30176c898d7a7 /pkg/gui/controllers/tags_controller.go
parent826128a8e03fb50f7287029ebac93c85712faecb (diff)
Begin refactoring gui
This begins a big refactor of moving more code out of the Gui struct into contexts, controllers, and helpers. We also move some code into structs in the gui package purely for the sake of better encapsulation
Diffstat (limited to 'pkg/gui/controllers/tags_controller.go')
-rw-r--r--pkg/gui/controllers/tags_controller.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/pkg/gui/controllers/tags_controller.go b/pkg/gui/controllers/tags_controller.go
index f4b23374c..a25c42f6a 100644
--- a/pkg/gui/controllers/tags_controller.go
+++ b/pkg/gui/controllers/tags_controller.go
@@ -56,6 +56,29 @@ func (self *TagsController) GetKeybindings(opts types.KeybindingsOpts) []*types.
return bindings
}
+func (self *TagsController) GetOnRenderToMain() func() error {
+ return func() error {
+ return self.helpers.Diff.WithDiffModeCheck(func() error {
+ var task types.UpdateTask
+ tag := self.context().GetSelected()
+ if tag == nil {
+ task = types.NewRenderStringTask("No tags")
+ } else {
+ cmdObj := self.git.Branch.GetGraphCmdObj(tag.FullRefName())
+ task = types.NewRunCommandTask(cmdObj.GetCmd())
+ }
+
+ return self.c.RenderToMainViews(types.RefreshMainOpts{
+ Pair: self.c.MainViewPairs().Normal,
+ Main: &types.ViewUpdateOpts{
+ Title: "Tag",
+ Task: task,
+ },
+ })
+ })
+ }
+}
+
func (self *TagsController) checkout(tag *models.Tag) error {
self.c.LogAction(self.c.Tr.Actions.CheckoutTag)
if err := self.helpers.Refs.CheckoutRef(tag.Name, types.CheckoutRefOptions{}); err != nil {