mirror of
https://codeberg.org/scip/ts.git
synced 2025-12-17 12:31:06 +01:00
38 lines
448 B
Go
38 lines
448 B
Go
package cmd
|
|
|
|
import (
|
|
"fmt"
|
|
"io"
|
|
"log"
|
|
"os"
|
|
)
|
|
|
|
func Die(err error) int {
|
|
log.Fatal("Error: ", err.Error())
|
|
|
|
return 1
|
|
}
|
|
|
|
func Main(output io.Writer) int {
|
|
conf, err := InitConfig(output)
|
|
if err != nil {
|
|
return Die(err)
|
|
}
|
|
|
|
if conf.Examples {
|
|
_, err := fmt.Fprintln(output, Examples)
|
|
if err != nil {
|
|
Die(err)
|
|
}
|
|
os.Exit(0)
|
|
}
|
|
|
|
tp := NewTP(conf)
|
|
|
|
if err := tp.ProcessTimestamps(); err != nil {
|
|
return Die(err)
|
|
}
|
|
|
|
return 0
|
|
}
|