Run will launch the termUI in the terminal
(cache *cache.RepoCache)
| 50 | |
| 51 | // Run will launch the termUI in the terminal |
| 52 | func Run(cache *cache.RepoCache) error { |
| 53 | ui = &termUI{ |
| 54 | gError: make(chan error, 1), |
| 55 | cache: cache, |
| 56 | bugTable: newBugTable(cache), |
| 57 | showBug: newShowBug(cache), |
| 58 | labelSelect: newLabelSelect(), |
| 59 | msgPopup: newMsgPopup(), |
| 60 | inputPopup: newInputPopup(), |
| 61 | } |
| 62 | |
| 63 | ui.activeWindow = ui.bugTable |
| 64 | |
| 65 | initGui(nil) |
| 66 | |
| 67 | err := <-ui.gError |
| 68 | |
| 69 | type errorStack interface { |
| 70 | ErrorStack() string |
| 71 | } |
| 72 | |
| 73 | if err != nil && err != gocui.ErrQuit { |
| 74 | if e, ok := err.(errorStack); ok { |
| 75 | fmt.Println(e.ErrorStack()) |
| 76 | } |
| 77 | return err |
| 78 | } |
| 79 | |
| 80 | return nil |
| 81 | } |
| 82 | |
| 83 | func initGui(action func(ui *termUI) error) { |
| 84 | g, err := gocui.NewGui(gocui.Output256, false) |
no test coverage detected