From 227bdd5dc81c6120c73c1207cb20869169491eef Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Fri, 1 Sep 2023 22:15:40 +0100 Subject: [PATCH] Add starting print line --- main.go | 42 +----------------------------------------- 1 file changed, 1 insertion(+), 41 deletions(-) diff --git a/main.go b/main.go index b93bbe9..2b98ec8 100644 --- a/main.go +++ b/main.go @@ -1,52 +1,12 @@ package main import ( - "flag" "fmt" - "image/png" - "os" - "github.com/boombuler/barcode" - - "git.fjla.uk/fred.boniface/barcodes/generation" - "git.fjla.uk/fred.boniface/barcodes/validation" "git.fjla.uk/fred.boniface/barcodes/web" ) func main() { - barcodeType := flag.String("type", "", "Barcode type (aztec, codabar, code93, code128, qr)") - content := flag.String("content", "", "Barcode content") - - flag.Parse() - - if *barcodeType == "" || *content == "" { - fmt.Println("Usage: ./barcodes --type --content ") - return - } - - fmt.Printf("Barcode Type: %s\n", *barcodeType) - fmt.Printf("Barcode Content: %s\n", *content) - - validation.Validate(*content, *barcodeType) - - parameters := generation.Parameters{ - Format: generation.BarcodeType(*barcodeType), - ECCLevel: generation.ECCLevel(3), - Content: *content, - } - - generated_barcode, err := generation.Generate(parameters) - if err != nil { - fmt.Println("Error: ", err) - os.Exit(1) - } - - generated_barcode, _ = barcode.Scale(generated_barcode, 200, 200) - - file, _ := os.Create("barcode.png") - defer file.Close() - png.Encode(file, generated_barcode) - + fmt.Println("Starting `barcodes` server") web.StartServer() - }