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
+11 -2
View File
@@ -24,8 +24,17 @@ func resolveConfigPath(args []string) (string, error) {
var config string
fs.StringVar(&config, "config", "", "path to the station config file")
fs.StringVar(&config, "c", "", "path to the station config file")
if err := fs.Parse(args); err != nil {
return "", err
rest := args
for {
if err := fs.Parse(rest); err != nil {
return "", err
}
rest = fs.Args()
if len(rest) == 0 {
break
}
// A non-flag word ends a parse. Skip it and keep later flags.
rest = rest[1:]
}
if config == "" {
path, err := defaultConfigPath()