aboutsummaryrefslogtreecommitdiffstats
path: root/termui/termui.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2022-12-27 17:31:32 +0100
committerGitHub <noreply@github.com>2022-12-27 17:31:32 +0100
commit8cea6c7515e42cb8821a03c9bfebb0a8f63a01be (patch)
tree2eaf6c403e0f6e8bf1fd1327afd275a226d93f1f /termui/termui.go
parent4c7043e8ed994d7863cfd706f6cfd2e1f91850df (diff)
parentd5b07f48376cef9f62e12e3b56bcdd7483ef588f (diff)
downloadgit-bug-8cea6c7515e42cb8821a03c9bfebb0a8f63a01be.tar.gz
Merge pull request #960 from MichaelMure/inputs
commands: move bug specific input code into commands/bug/input
Diffstat (limited to 'termui/termui.go')
-rw-r--r--termui/termui.go30
1 files changed, 14 insertions, 16 deletions
diff --git a/termui/termui.go b/termui/termui.go
index 79577ba9..d640ed1c 100644
--- a/termui/termui.go
+++ b/termui/termui.go
@@ -8,7 +8,7 @@ import (
"github.com/pkg/errors"
"github.com/MichaelMure/git-bug/cache"
- "github.com/MichaelMure/git-bug/commands/input"
+ buginput "github.com/MichaelMure/git-bug/commands/bug/input"
"github.com/MichaelMure/git-bug/entity"
"github.com/MichaelMure/git-bug/query"
"github.com/MichaelMure/git-bug/util/text"
@@ -187,14 +187,14 @@ func newBugWithEditor(repo *cache.RepoCache) error {
ui.g.Close()
ui.g = nil
- title, message, err := input.BugCreateEditorInput(ui.cache, "", "")
+ title, message, err := buginput.BugCreateEditorInput(ui.cache, "", "")
- if err != nil && err != input.ErrEmptyTitle {
+ if err != nil && err != buginput.ErrEmptyTitle {
return err
}
var b *cache.BugCache
- if err == input.ErrEmptyTitle {
+ if err == buginput.ErrEmptyTitle {
ui.msgPopup.Activate(msgPopupErrorTitle, "Empty title, aborting.")
initGui(nil)
@@ -230,13 +230,11 @@ func addCommentWithEditor(bug *cache.BugCache) error {
ui.g.Close()
ui.g = nil
- message, err := input.BugCommentEditorInput(ui.cache, "")
-
- if err != nil && err != input.ErrEmptyMessage {
+ message, err := buginput.BugCommentEditorInput(ui.cache, "")
+ if err != nil && err != buginput.ErrEmptyMessage {
return err
}
-
- if err == input.ErrEmptyMessage {
+ if err == buginput.ErrEmptyMessage {
ui.msgPopup.Activate(msgPopupErrorTitle, "Empty message, aborting.")
} else {
_, _, err := bug.AddComment(text.Cleanup(message))
@@ -263,12 +261,12 @@ func editCommentWithEditor(bug *cache.BugCache, target entity.CombinedId, preMes
ui.g.Close()
ui.g = nil
- message, err := input.BugCommentEditorInput(ui.cache, preMessage)
- if err != nil && err != input.ErrEmptyMessage {
+ message, err := buginput.BugCommentEditorInput(ui.cache, preMessage)
+ if err != nil && err != buginput.ErrEmptyMessage {
return err
}
- if err == input.ErrEmptyMessage {
+ if err == buginput.ErrEmptyMessage {
// TODO: Allow comments to be deleted?
ui.msgPopup.Activate(msgPopupErrorTitle, "Empty message, aborting.")
} else if message == preMessage {
@@ -300,13 +298,13 @@ func setTitleWithEditor(bug *cache.BugCache) error {
snap := bug.Snapshot()
- title, err := input.BugTitleEditorInput(ui.cache, snap.Title)
+ title, err := buginput.BugTitleEditorInput(ui.cache, snap.Title)
- if err != nil && err != input.ErrEmptyTitle {
+ if err != nil && err != buginput.ErrEmptyTitle {
return err
}
- if err == input.ErrEmptyTitle {
+ if err == buginput.ErrEmptyTitle {
ui.msgPopup.Activate(msgPopupErrorTitle, "Empty title, aborting.")
} else if title == snap.Title {
ui.msgPopup.Activate(msgPopupErrorTitle, "No change, aborting.")
@@ -335,7 +333,7 @@ func editQueryWithEditor(bt *bugTable) error {
ui.g.Close()
ui.g = nil
- queryStr, err := input.QueryEditorInput(bt.repo, bt.queryStr)
+ queryStr, err := buginput.QueryEditorInput(bt.repo, bt.queryStr)
if err != nil {
return err