From: Mattia Cabrini Date: Tue, 15 Aug 2023 09:55:58 +0000 (+0200) Subject: Editor X-Git-Tag: v0.0.5 X-Git-Url: https://git.theboydaily.dev/mattia?a=commitdiff_plain;h=b67950f4635343aa665fc3faa1fead57f4857f0b;p=go-utility.git Editor --- diff --git a/editor.go b/editor.go new file mode 100644 index 0000000..a5a17b6 --- /dev/null +++ b/editor.go @@ -0,0 +1,22 @@ +// Copyright (c) 2023 Mattia Cabrini +// SPDX-License-Identifier: MIT + +package utility + +import ( + "os" + "os/exec" +) + +func Editor(editorPath string, path string) (err error) { + editor := exec.Command(editorPath, path) + editor.Stdin = os.Stdin + editor.Stderr = os.Stderr + editor.Stdout = os.Stdout + + if err = editor.Run(); err != nil { + return + } + + return +}