Browse Source

cdrtool: add debug and execute flag; cdr: move import Go files

master
Gerdriaan Mulder 6 years ago
parent
commit
a93601653e
  1. 16
      cmd/cdrtool/main.go
  2. 0
      import_cdr.go
  3. 2
      import_price.go

16
cmd/cdrtool/main.go

@ -13,6 +13,8 @@ var (
csvFile = flag.String("csv", "", "use this call detail record CSV file")
validate = flag.Bool("validate", false, "only validate the call detail record CSV, perform no other actions")
pricesFile = flag.String("prices", "", "use this pricing CSV file")
priceExec = flag.Bool("execute", false, "price each CDR according to the prices file")
debug = flag.Bool("debug", false, "show extra debugging")
)
func usage() {
@ -58,11 +60,17 @@ func main() {
log.Fatalf("importing CSV failed: %v", err)
}
for _, i := range imported {
fmt.Printf("l: %+v\n", i)
if *debug {
for _, i := range imported {
fmt.Printf("l: %+v\n", i)
}
for _, i := range importedPrices {
fmt.Printf("p: %+v\n", i)
}
}
for _, i := range importedPrices {
fmt.Printf("p: %+v\n", i)
if *priceExec {
}
}

0
import.go → import_cdr.go

2
pricing.go → import_price.go

@ -88,7 +88,7 @@ func ImportPricesFile(fn string) ([]Price, error) {
"Mobile",
}
for _, line := range all {
if line[PriceImportRegion] == "Regio" || line[PriceImportDestination] == "" {
if line[PriceImportRegion] == "Regio" || line[PriceImportDestination] == "" {
// Header line or no destination
continue
}
Loading…
Cancel
Save