Keep a later config flag when extra words are present.

A non-flag word no longer stops parsing, and a missing home directory refuses to create or rewrite a config instead of writing an empty log path.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-07 12:42:01 +02:00
co-authored by Cursor
parent 465a26911e
commit 87e366e36c
6 changed files with 317 additions and 14 deletions
+14
View File
@@ -2,6 +2,8 @@ package main
import (
"context"
"fmt"
"io"
"gitea.neitzel.de/konrad/funknetz/audio"
"gitea.neitzel.de/konrad/funknetz/station"
@@ -51,3 +53,15 @@ func openStation(args []string) (*station.Station, error) {
}
return station.New(station.Options{ConfigPath: path})
}
// openStationReported opens the station from args. A flag or config failure is
// one line on stderr and the returned error. The window is not opened.
func openStationReported(args []string, stderr io.Writer) (*station.Station, error) {
st, err := openStation(args)
if err != nil {
// The returned error is the failure. A write error does not replace it.
_, _ = fmt.Fprintln(stderr, err.Error())
return nil, err
}
return st, nil
}