Fix up some miscellaneous shit around the project regarding lua conversions
This commit is contained in:
28
main.go
28
main.go
@@ -32,7 +32,6 @@ var logger *log.Logger
|
||||
|
||||
var (
|
||||
fileModeFlag = flag.String("mode", "regex", "Processing mode: regex, xml, json")
|
||||
verboseFlag = flag.Bool("verbose", false, "Enable verbose output")
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -48,12 +47,6 @@ func main() {
|
||||
fmt.Fprintf(os.Stderr, "\nOptions:\n")
|
||||
fmt.Fprintf(os.Stderr, " -mode string\n")
|
||||
fmt.Fprintf(os.Stderr, " Processing mode: regex, xml, json (default \"regex\")\n")
|
||||
fmt.Fprintf(os.Stderr, " -xpath string\n")
|
||||
fmt.Fprintf(os.Stderr, " XPath expression (for XML mode)\n")
|
||||
fmt.Fprintf(os.Stderr, " -jsonpath string\n")
|
||||
fmt.Fprintf(os.Stderr, " JSONPath expression (for JSON mode)\n")
|
||||
fmt.Fprintf(os.Stderr, " -verbose\n")
|
||||
fmt.Fprintf(os.Stderr, " Enable verbose output\n")
|
||||
fmt.Fprintf(os.Stderr, "\nExamples:\n")
|
||||
fmt.Fprintf(os.Stderr, " Regex mode (default):\n")
|
||||
fmt.Fprintf(os.Stderr, " %s \"<value>(\\d+)</value>\" \"*1.5\" data.xml\n", os.Args[0])
|
||||
@@ -83,15 +76,9 @@ func main() {
|
||||
var pattern, luaExpr string
|
||||
var filePatterns []string
|
||||
|
||||
if *fileModeFlag == "regex" {
|
||||
pattern = args[0]
|
||||
luaExpr = args[1]
|
||||
filePatterns = args[2:]
|
||||
} else {
|
||||
// For XML/JSON modes, pattern comes from flags
|
||||
luaExpr = args[0]
|
||||
filePatterns = args[1:]
|
||||
}
|
||||
pattern = args[0]
|
||||
luaExpr = args[1]
|
||||
filePatterns = args[2:]
|
||||
|
||||
// Prepare the Lua expression
|
||||
originalLuaExpr := luaExpr
|
||||
@@ -124,11 +111,10 @@ func main() {
|
||||
// pattern = *xpathFlag
|
||||
// logger.Printf("Starting XML modifier with XPath %q, expression %q on %d files",
|
||||
// pattern, luaExpr, len(files))
|
||||
// case "json":
|
||||
// proc = &processor.JSONProcessor{}
|
||||
// pattern = *jsonpathFlag
|
||||
// logger.Printf("Starting JSON modifier with JSONPath %q, expression %q on %d files",
|
||||
// pattern, luaExpr, len(files))
|
||||
case "json":
|
||||
proc = &processor.JSONProcessor{}
|
||||
logger.Printf("Starting JSON modifier with JSONPath %q, expression %q on %d files",
|
||||
pattern, luaExpr, len(files))
|
||||
}
|
||||
|
||||
var wg sync.WaitGroup
|
||||
|
Reference in New Issue
Block a user