Files
narratio/internal/app/session_config_path.go

26 lines
766 B
Go
Raw Normal View History

package app
import (
"fmt"
"strings"
)
2026-05-20 20:55:13 -05:00
func missingSessionConfigError(searched []string, remoteDetail string) error {
ordered := append([]string(nil), searched...)
if len(ordered) == 0 {
2026-05-20 20:55:13 -05:00
if strings.TrimSpace(remoteDetail) != "" {
return fmt.Errorf("no session config path provided and no default locations configured; %s", remoteDetail)
}
return fmt.Errorf("no session config path provided and no default locations configured")
}
2026-05-20 20:55:13 -05:00
msg := fmt.Sprintf(
"no session config path provided and no default session config found; searched: %s",
strings.Join(ordered, ", "),
)
2026-05-20 20:55:13 -05:00
if strings.TrimSpace(remoteDetail) != "" {
msg += "; " + strings.TrimSpace(remoteDetail)
}
msg += "; pass --session to use an explicit path"
return fmt.Errorf("%s", msg)
}