t

commit 7305b757c9de09e34febe52b98cda46b6c595c5a

Author: Pedro Lucas Porcellis <pedrolucasporcellis@gmail.com>

Write something to a file command

 commands/write.go | 16 ++++++++++++++++


diff --git a/commands/write.go b/commands/write.go
new file mode 100644
index 0000000000000000000000000000000000000000..237c0a48ca58cd7f9d520d26a605f8001fb880c9
--- /dev/null
+++ b/commands/write.go
@@ -0,0 +1,16 @@
+package commands
+
+import (
+	"git.sr.ht/~porcellis/t/models"
+	"os"
+	"os/exec"
+)
+
+func Write(note models.Note) error {
+	cmd := exec.Command("vim", note.Path)
+	cmd.Stdin = os.Stdin
+	cmd.Stdout = os.Stdout
+	cmd.Stderr = os.Stderr
+
+	return cmd.Run()
+}