Refactor for better modularity (share more code among edit functions, rename "offline" package to "backend"

This commit is contained in:
2024-04-15 18:16:05 -04:00
parent 53e0799a4a
commit 257a698b88
19 changed files with 834 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
//go:build windows
package backend
import (
"fmt"
"os"
)
const FallbackEditor = "nvim" // since there is no pre-installed CLI editor on Windows, default to the most popular one
// dirInit creates the libmutton directories
func dirInit() {
// create EntryRoot (includes config directory on Windows)
err := os.MkdirAll(EntryRoot, 0700)
if err != nil {
fmt.Println(AnsiError + "Failed to create \"" + EntryRoot + "\":" + err.Error() + AnsiReset)
os.Exit(1)
}
}
// textEditorFallback returns FallbackEditor
func textEditorFallback() string {
return FallbackEditor
}