You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
458 B

2 years ago
package cmd
2 years ago
import (
"flag"
"fmt"
"log"
2 years ago
"os"
"jxs.me/proto/mps"
2 years ago
)
2 years ago
2 years ago
func Root() error {
args := flag.NewFlagSet("root", flag.ExitOnError)
args.Parse(os.Args[1:])
source := args.Arg(0)
if source == "" {
return fmt.Errorf("File is required")
}
sourceFile, err := os.Open(source)
if err != nil {
return err
}
defer sourceFile.Close()
tx, err := mps.Parse(sourceFile)
log.Printf("Parsed %d records", tx.Header.RecordCount)
return err
2 years ago
}