~laumann/acme-git

bfb36ff2991d5b2a192e7a782e5260e1006e1d8c — Thomas Bracht Laumann Jespersen 2 years ago 35b4e59
Add "Show" and a little cleanup
1 files changed, 12 insertions(+), 10 deletions(-)

M Git.go
M Git.go => Git.go +12 -10
@@ 43,6 43,7 @@ func gitcmd(arg ...string) {
			win.Write("data", buf)
		}
	}
	win.Ctl("clean")
}

func diff() {


@@ 53,16 54,12 @@ func status() {
	gitcmd("status")
}

func commit() {
	// I can see a couple of ways to implement "commit". (1) Open another buffer
	// to hold the commit message, and when closing that buffer capture the content
	// and pass it into git commit somehow. (2) write a script to be the "editor" that pops open a buffer and waits for it to be closed, then uses the contents as the commit message.
func show() {
	gitcmd("show")
}

func commit() {
	wipe()
	// Call mktemp, get the file name
	// Run the following:
	// GIT_EDITOR=./acme-ed.sh git commit
	// Our "editor" will be acme-ed, that pops open the file provided by git and monitors the index (or the events?) to exit only when the commit message buffer gets closed.

	cmd := exec.Command("git", "commit")
	r, w, err := os.Pipe()


@@ 88,7 85,9 @@ func commit() {
		if n > 0 {
			win.Write("data", buf)
		}
	}}
	}
	win.Ctl("clean")
}

func main() {
	var err error


@@ 102,7 101,8 @@ func main() {
	win.Name(pwdslash + "+git")
	win.Ctl("clean")

	win.Fprintf("tag", "Status Diff Log Commit")
	win.Fprintf("tag", "Status Show Diff Log Commit")
	status()

	go events()
	r, err := acme.Log()


@@ 135,6 135,8 @@ func events() {
				diff()
			case "Commit":
				commit()
			case "Show":
				show()
			default:
				fmt.Println(text)
			}