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
32 lines
458 B
package cmd
|
|
|
|
import (
|
|
"flag"
|
|
"fmt"
|
|
"log"
|
|
"os"
|
|
|
|
"jxs.me/proto/mps"
|
|
)
|
|
|
|
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
|
|
}
|