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.
25 lines
549 B
25 lines
549 B
package main
|
|
|
|
import (
|
|
"flag"
|
|
"log"
|
|
"github.com/skip2/go-qrcode"
|
|
)
|
|
|
|
func main() {
|
|
// Define flags
|
|
data := flag.String("data", "", "Data to encode in QR code")
|
|
output := flag.String("output", "qrcode.png", "Output filename for QR code")
|
|
flag.Parse()
|
|
|
|
// Validate required flag
|
|
if *data == "" {
|
|
log.Fatal("Data is required. Usage: -data <text> [-output <filename>]")
|
|
}
|
|
|
|
err := qrcode.WriteFile(*data, qrcode.Highest, 512, *output)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
log.Printf("QR code with data '%s' saved as %s\n", *data, *output)
|
|
}
|
|
|