summaryrefslogtreecommitdiff
path: root/pkg/gonf.go
diff options
context:
space:
mode:
authorJulien Dessaux2024-03-07 00:54:35 +0100
committerJulien Dessaux2024-03-07 01:02:23 +0100
commit560becfd32dd7355547938f3c6229060dd395aab (patch)
tree42329f4e47c64349ae8a0205f867632ac52bcdc6 /pkg/gonf.go
parentfeat(stdlib): began adding systemd services support (diff)
downloadgonf-560becfd32dd7355547938f3c6229060dd395aab.tar.gz
gonf-560becfd32dd7355547938f3c6229060dd395aab.tar.bz2
gonf-560becfd32dd7355547938f3c6229060dd395aab.zip
chore(repo): renamed gonf subfolder to something more traditional in go land
Diffstat (limited to 'pkg/gonf.go')
-rw-r--r--pkg/gonf.go52
1 files changed, 52 insertions, 0 deletions
diff --git a/pkg/gonf.go b/pkg/gonf.go
new file mode 100644
index 0000000..363a227
--- /dev/null
+++ b/pkg/gonf.go
@@ -0,0 +1,52 @@
+package gonf
+
+import (
+ "log/slog"
+ "os"
+)
+
+func EnableDebugLogs() {
+ h := slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{
+ Level: slog.LevelDebug,
+ })
+ slog.SetDefault(slog.New(h))
+}
+
+func Resolve() (status Status) {
+ for {
+ // ----- Files -------------------------------------------------
+ status = resolveFiles()
+ switch status {
+ case BROKEN:
+ return BROKEN
+ case REPAIRED:
+ continue
+ }
+ // ----- Packages ----------------------------------------------
+ status = resolvePackages()
+ switch status {
+ case BROKEN:
+ return BROKEN
+ case REPAIRED:
+ packages_list_function()
+ continue
+ }
+ // ----- Services ----------------------------------------------
+ status = resolveServices()
+ switch status {
+ case BROKEN:
+ return BROKEN
+ case REPAIRED:
+ continue
+ }
+ // ----- Commands ----------------------------------------------
+ status = resolveCommands()
+ switch status {
+ case BROKEN:
+ return BROKEN
+ case REPAIRED:
+ continue
+ }
+ return
+ }
+}