@@ 1,91 @@
+package main
+
+import (
+ "fmt"
+ "os"
+ "os/exec"
+ "log"
+ "strings"
+ "9fans.net/go/acme"
+)
+
+var win *acme.Win
+
+func status() {
+ cmd := exec.Command("git", "status")
+ r, w, err := os.Pipe()
+ if err != nil {
+ log.Fatal(err)
+ }
+ cmd.Stdout = w
+ cmd.Stderr = w
+
+ err = cmd.Start()
+ w.Close()
+ if err != nil {
+ r.Close()
+ win.Fprintf("data", "(exec: %s)\n", err)
+ }
+
+ buf := make([]byte, 4096)
+ for {
+ n, err := r.Read(buf)
+ if err != nil {
+ break
+ }
+ if n > 0 {
+ win.Write("data", buf)
+ }
+ }
+}
+
+func main() {
+ var err error
+
+ win, err = acme.New()
+ if err != nil {
+ log.Fatal(err)
+ }
+ pwd, _ := os.Getwd()
+ pwdslash := strings.TrimSuffix(pwd, "/") + "/"
+ win.Name(pwdslash + "+git")
+ win.Ctl("clean")
+
+ win.Fprintf("tag", "Status Diff Log Commit")
+ win.Fprintf("body", "PLACEHOLDER")
+
+ go events()
+ r, err := acme.Log()
+ if err != nil {
+ log.Fatal(err)
+ }
+ for {
+ ev, err := r.Read()
+ if err != nil {
+ log.Fatal(err)
+ }
+ if ev.Op == "put" {
+ fmt.Println("Saved!")
+ }
+ }
+}
+
+func events() {
+ for e := range win.EventChan() {
+ switch e.C2 {
+ case 'x', 'X': // execute
+ text := string(e.Text)
+ switch text {
+ case "Kill", "Quit", "Del":
+ win.Ctl("delete")
+ case "Status":
+ status()
+ default:
+ fmt.Println(text)
+ }
+ }
+ win.WriteEvent(e)
+ }
+ os.Exit(0)
+}
+ <
\ No newline at end of file