First start: create the config file and open the Config view
Without a config file arr-tui refused to start. It now creates an empty one (private, with its directory) and opens the Config view. A service with neither address nor key is "not configured", which validation allows: its client returns ErrNotConfigured without a request, its indicator stays grey, it is logged once as information, and its lists say so instead of showing errors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019reK4DUGYqDUjniWYJvwUW
This commit is contained in:
@@ -2,8 +2,10 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"os"
|
||||
|
||||
"git.stinnesbeck.com/nils/arr-tui/internal/config"
|
||||
@@ -38,6 +40,13 @@ func run() error {
|
||||
*path = p
|
||||
}
|
||||
|
||||
// No config yet (first start): create an empty one, the Config view fills it in.
|
||||
if _, err := os.Stat(*path); errors.Is(err, fs.ErrNotExist) {
|
||||
if err := config.Create(*path); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
cfg, warnings, err := config.Load(*path)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user