Derive artifact catalogs from the selected party without changing configuration
This commit is contained in:
@@ -24,7 +24,12 @@ func resolvePartyInput(input ResolvedInputFile) (ResolvedParty, error) {
|
||||
if err != nil {
|
||||
return ResolvedParty{}, fmt.Errorf("parse party input %q: %w", path, err)
|
||||
}
|
||||
players, err := party.PlayersYAML()
|
||||
if err != nil {
|
||||
return ResolvedParty{}, err
|
||||
}
|
||||
return ResolvedParty{
|
||||
Players: players,
|
||||
Source: PartySource{
|
||||
Path: path,
|
||||
ConfigPath: configPath,
|
||||
@@ -59,3 +64,19 @@ func resolveCampaignParty(campaignPath string, campaign *CampaignConfig) (Resolv
|
||||
}
|
||||
return resolvePartyInput(input)
|
||||
}
|
||||
|
||||
// ResolveParty loads the exact explicit party file, or the campaign's configured
|
||||
// default. Explicit paths are relative to the invocation directory.
|
||||
func ResolveParty(campaignPath string, campaign *CampaignConfig, explicitFile *string) (ResolvedParty, error) {
|
||||
if explicitFile == nil {
|
||||
return resolveCampaignParty(campaignPath, campaign)
|
||||
}
|
||||
if *explicitFile == "" {
|
||||
return ResolvedParty{}, fmt.Errorf("explicit party file path is required")
|
||||
}
|
||||
path, err := filepath.Abs(*explicitFile)
|
||||
if err != nil {
|
||||
return ResolvedParty{}, fmt.Errorf("resolve explicit party file: %w", err)
|
||||
}
|
||||
return resolvePartyInput(ResolvedInputFile{Path: path, ConfigPath: path, Source: "party_file"})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user