Redo old format
Why did I even remove it?
This commit is contained in:
27
main.go
27
main.go
@@ -67,7 +67,10 @@ func main() {
|
|||||||
go ReadFromStdin(instructions, status)
|
go ReadFromStdin(instructions, status)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if _, err := os.Stat("sync.yaml"); err == nil {
|
if _, err := os.Stat("sync"); err == nil {
|
||||||
|
LogInfo("Using default sync file")
|
||||||
|
go ReadFromFile("sync", instructions, status, true)
|
||||||
|
} else if _, err := os.Stat("sync.yaml"); err == nil {
|
||||||
LogInfo("Using default sync.yaml file")
|
LogInfo("Using default sync.yaml file")
|
||||||
go ReadFromFile("sync.yaml", instructions, status, true)
|
go ReadFromFile("sync.yaml", instructions, status, true)
|
||||||
} else if _, err := os.Stat("sync.yml"); err == nil {
|
} else if _, err := os.Stat("sync.yml"); err == nil {
|
||||||
@@ -224,6 +227,28 @@ func ReadFromFile(input string, output chan *LinkInstruction, status chan error,
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle CSV format (legacy)
|
||||||
|
file, err := os.Open(input)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("Failed to open file %s%s%s: %s%+v%s",
|
||||||
|
SourceColor, input, DefaultColor, ErrorColor, err, DefaultColor)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
defer file.Close()
|
||||||
|
|
||||||
|
scanner := bufio.NewScanner(file)
|
||||||
|
for scanner.Scan() {
|
||||||
|
line := scanner.Text()
|
||||||
|
instruction, err := ParseInstruction(line, filepath.Dir(input))
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Error parsing line: %s'%s'%s, error: %s%+v%s",
|
||||||
|
SourceColor, line, DefaultColor, ErrorColor, err, DefaultColor)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
log.Printf("Read instruction: %s", instruction.String())
|
||||||
|
output <- &instruction
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func ReadFromArgs(output chan *LinkInstruction, status chan error) {
|
func ReadFromArgs(output chan *LinkInstruction, status chan error) {
|
||||||
|
Reference in New Issue
Block a user