package note import ( "fmt" "os" "strings" "github.com/kballard/go-shellquote" "github.com/mickael-menu/zk/core/zk" "github.com/mickael-menu/zk/util/errors" executil "github.com/mickael-menu/zk/util/exec" "github.com/mickael-menu/zk/util/opt" osutil "github.com/mickael-menu/zk/util/os" ) // Edit starts the editor with the notes at given paths. func Edit(zk *zk.Zk, paths ...string) error { editor := editor(zk) if editor.IsNull() { return fmt.Errorf("no editor set in config") } // /dev/tty is restored as stdin, in case the user used a pipe to feed // initial note content to `zk new`. Without this, Vim doesn't work // properly in this case. // See https://github.com/mickael-menu/zk/issues/4 cmd := executil.CommandFromString(editor.String() + " " + shellquote.Join(paths...) + "