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:
+11
-2
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user