feat(config): internal/config (load/save atomik + validasi) — wiring bahasa/suara/animasi + doctor baca config
CI / test (push) Successful in 13m3s
CI / test (push) Successful in 13m3s
This commit is contained in:
1 parent
36bc33f904
commit
c65d2cb75d
8 files changed
+328
-15
No files matched your search
+16
-3
@@ -7,11 +7,11 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"gitea.oxpoe.qzz.io/oxpoe/tia-love/internal/audio"
|
||||
"gitea.oxpoe.qzz.io/oxpoe/tia-love/internal/config"
|
||||
"gitea.oxpoe.qzz.io/oxpoe/tia-love/internal/docker"
|
||||
"gitea.oxpoe.qzz.io/oxpoe/tia-love/internal/i18n"
|
||||
)
|
||||
@@ -51,8 +51,21 @@ func Doctor(w io.Writer) int {
|
||||
|
||||
fmt.Fprintf(w, "go : %s (%s/%s)\n", runtime.Version(), runtime.GOOS, runtime.GOARCH)
|
||||
|
||||
home, _ := os.UserHomeDir()
|
||||
stacks := filepath.Join(home, ".tia", "stacks")
|
||||
// Konfigurasi & direktori stack.
|
||||
cfg, cfgErr := config.Load()
|
||||
cfgPath := config.Path()
|
||||
switch {
|
||||
case cfgErr != nil:
|
||||
fmt.Fprintf(w, "config : %s %v\n", i18n.T("error.warn"), cfgErr)
|
||||
default:
|
||||
if _, err := os.Stat(cfgPath); err != nil {
|
||||
fmt.Fprintf(w, "config : %s\n", i18n.Tf("doctor.configMissing", cfgPath))
|
||||
} else {
|
||||
fmt.Fprintf(w, "config : %s\n", cfgPath)
|
||||
}
|
||||
}
|
||||
|
||||
stacks := config.ExpandPath(cfg.StacksDir)
|
||||
if st, err := os.Stat(stacks); err == nil && st.IsDir() {
|
||||
fmt.Fprintf(w, "stacks : %s\n", stacks)
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user