diff --git a/instruction.go b/instruction.go index cb91e45..791ed8e 100644 --- a/instruction.go +++ b/instruction.go @@ -270,17 +270,25 @@ func ParseYAMLFile(filename, workdir string) ([]LinkInstruction, error) { return nil, fmt.Errorf("error reading YAML file: %w", err) } - // First try to parse as a list of link instructions + // First try to parse as a YAMLConfig with links and from fields var config YAMLConfig err = yaml.Unmarshal(data, &config) - if err != nil || len(config.Links) == 0 { + LogInfo("First parsing attempt: err=%v, links=%d, from=%d", err, len(config.Links), len(config.From)) + if err != nil { // If that fails, try parsing as a direct list of instructions var instructions []LinkInstruction err = yaml.Unmarshal(data, &instructions) if err != nil { return nil, fmt.Errorf("error parsing YAML: %w", err) } - config.Links = instructions + // Filter out invalid instructions (empty source) + validInstructions := []LinkInstruction{} + for _, instr := range instructions { + if instr.Source != "" { + validInstructions = append(validInstructions, instr) + } + } + config.Links = validInstructions } expanded := []LinkInstruction{}