aboutsummaryrefslogtreecommitdiffstats
path: root/input/input.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-09-21 18:18:51 +0200
committerMichael Muré <batolettre@gmail.com>2018-09-21 18:53:37 +0200
commit82eaceffc1d750832a2a66f206749d2dca968cce (patch)
tree1431c8f1fd9baa689b850da7f104d12c20b1d8a7 /input/input.go
parent6a575fbf483e2b28821908f67e87637d9e5cea75 (diff)
downloadgit-bug-82eaceffc1d750832a2a66f206749d2dca968cce.tar.gz
repo: split the Repo interface to avoid abstraction leak in RepoCache
Diffstat (limited to 'input/input.go')
-rw-r--r--input/input.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/input/input.go b/input/input.go
index 4b70bbd4..6a7c8c7c 100644
--- a/input/input.go
+++ b/input/input.go
@@ -35,7 +35,7 @@ const bugTitleCommentTemplate = `%s%s
// BugCreateEditorInput will open the default editor in the terminal with a
// template for the user to fill. The file is then processed to extract title
// and message.
-func BugCreateEditorInput(repo repository.Repo, preTitle string, preMessage string) (string, string, error) {
+func BugCreateEditorInput(repo repository.RepoCommon, preTitle string, preMessage string) (string, string, error) {
if preMessage != "" {
preMessage = "\n\n" + preMessage
}
@@ -86,7 +86,7 @@ const bugCommentTemplate = `
// BugCommentEditorInput will open the default editor in the terminal with a
// template for the user to fill. The file is then processed to extract a comment.
-func BugCommentEditorInput(repo repository.Repo) (string, error) {
+func BugCommentEditorInput(repo repository.RepoCommon) (string, error) {
raw, err := launchEditorWithTemplate(repo, messageFilename, bugCommentTemplate)
if err != nil {
@@ -121,7 +121,7 @@ const bugTitleTemplate = `%s
// BugTitleEditorInput will open the default editor in the terminal with a
// template for the user to fill. The file is then processed to extract a title.
-func BugTitleEditorInput(repo repository.Repo, preTitle string) (string, error) {
+func BugTitleEditorInput(repo repository.RepoCommon, preTitle string) (string, error) {
template := fmt.Sprintf(bugTitleTemplate, preTitle)
raw, err := launchEditorWithTemplate(repo, messageFilename, template)
@@ -180,7 +180,7 @@ const queryTemplate = `%s
// QueryEditorInput will open the default editor in the terminal with a
// template for the user to fill. The file is then processed to extract a query.
-func QueryEditorInput(repo repository.Repo, preQuery string) (string, error) {
+func QueryEditorInput(repo repository.RepoCommon, preQuery string) (string, error) {
template := fmt.Sprintf(queryTemplate, preQuery)
raw, err := launchEditorWithTemplate(repo, messageFilename, template)
@@ -206,7 +206,7 @@ func QueryEditorInput(repo repository.Repo, preQuery string) (string, error) {
// launchEditorWithTemplate will launch an editor as launchEditor do, but with a
// provided template.
-func launchEditorWithTemplate(repo repository.Repo, fileName string, template string) (string, error) {
+func launchEditorWithTemplate(repo repository.RepoCommon, fileName string, template string) (string, error) {
path := fmt.Sprintf("%s/.git/%s", repo.GetPath(), fileName)
err := ioutil.WriteFile(path, []byte(template), 0644)
@@ -227,7 +227,7 @@ func launchEditorWithTemplate(repo repository.Repo, fileName string, template st
//
// This method returns the text that was read from the temporary file, or
// an error if any step in the process failed.
-func launchEditor(repo repository.Repo, fileName string) (string, error) {
+func launchEditor(repo repository.RepoCommon, fileName string) (string, error) {
path := fmt.Sprintf("%s/.git/%s", repo.GetPath(), fileName)
defer os.Remove(path)