func getDateTo() schema.Datum { datum := schema.Datum{} t, err := time.Parse(hunDateForm, os.Args[4]) if err == nil { datum.Time = &t util.Log(datum, "Datum found: %v") } if datum.Time == nil { util.Log("", "Datum not found %s") } return datum }
func getOutputFile() string { outputFile := os.Args[1] util.Log(outputFile, "Output file: %s") return outputFile }
func argCheck() { if len(os.Args) == 7 { return } fmt.Printf("Invalid argument count: %d\n", len(os.Args)) util.Log("Args:", "%s") for i := 0; i < len(os.Args); i++ { util.Log(os.Args[i], "%s") } fmt.Println("Usage:") fmt.Println("Windows: invoice-export.exe <output-file> <dbf-directory> <invoice-date-start> <invoice-date-end> <invoice-number-start> <invoice-number-end>") fmt.Println("Linux: invoice-export.exe <output-file> <dbf-directory> <invoice-date-start> <invoice-date-end> <invoice-number-start> <invoice-number-end>") os.Exit(-1) }
func getInvoiceTo() string { invoiceTo := os.Args[6] if invoiceTo == "" { util.Log(invoiceTo, "Invoice number not found: %s") } return invoiceTo }
func getInvoiceFrom() string { invoiceFrom := os.Args[5] if invoiceFrom == "" { util.Log(invoiceFrom, "Invoice number not found: %s") } return invoiceFrom }