Audit with AI

This commit is contained in:
2025-11-16 11:37:02 +05:30
parent 551e2123bc
commit 29cddb6389
24 changed files with 1286 additions and 79 deletions

View File

@@ -9,29 +9,42 @@ import (
"os"
)
const usageTxt = `Please provide output director and input schema.
var (
showVersion bool
)
const usageTxt = `Please provide output directory and input schema.
Example:
pgm/cmd -o ./db ./db/schema.sql
pgm -o ./db ./schema.sql
`
func main() {
var outDir string
flag.StringVar(&outDir, "o", "", "-o as output directory path")
flag.BoolVar(&showVersion, "version", false, "show version information")
flag.Parse()
// Handle version flag
if showVersion {
fmt.Printf("pgm %s\n", GetVersionString())
fmt.Println("PostgreSQL Query Mapper - Schema code generator")
fmt.Println("https://code.patial.tech/go/pgm")
return
}
if len(os.Args) < 4 {
fmt.Print(usageTxt)
return
}
if outDir == "" {
println("missing, -o output directory path")
fmt.Fprintln(os.Stderr, "Error: missing output directory path (-o flag required)")
os.Exit(1)
return
}
if err := generate(os.Args[3], outDir); err != nil {
println(err.Error())
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
os.Exit(1)
}
}