<commit_before>package main

import (
	"flag"
	"fmt"
	"os"

	zglob "github.com/mattn/go-zglob"
	"github.com/minodisk/sqlabble/cmd/sqlabble/generator"
)

func main() {
	if err := _main; err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(2)
	}
}

func _main() error {
	op, files, err := Parse(os.Args)
	if err != nil {
		return err
	}
	for _, file := range files {
		if err := generator.ConvertFile(file, op); err != nil {
			return err
		}
	}
	return nil
}

func Parse(args []string) (generator.Options, []string, error) {
	op := generator.Options{}

	fs := flag.NewFlagSet("sqlabble", flag.ExitOnError)
	fs.Usage = func() {
		name := args[0]
		fmt.Fprintf(os.Stderr, `%s is a code generation tool that implements a method that returns a table or column to a struct.

Usage:

  %s [flags] [glob]

Flags:

`, name, name)
		fs.PrintDefaults()
		fmt.Fprintf(os.Stderr, `
Examples:

  %s ./*.go
  %s ./**/*.go
  %s -suffix _gen ./**/*.go
`)
	}
	fs.StringVar(&op.Suffix, "suffix", "_sqlabble", "suffix of the file to be generated")
	if err := fs.Parse(args); err != nil {
		return op, nil, err
	}

	patterns := fs.Args()
	if len(patterns) == 0 {
		patterns = []string{"./*.go"}<commit_msg>Fix to get arguments correctly<commit_after>package main

import (
	"flag"
	"fmt"
	"os"

	zglob "github.com/mattn/go-zglob"
	"github.com/minodisk/sqlabble/cmd/sqlabble/generator"
)

func main() {
	if err := _main(); err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(2)
	}
}

func _main() error {
	op, files, err := Parse(os.Args)
	if err != nil {
		return err
	}
	for _, file := range files {
		if err := generator.ConvertFile(file, op); err != nil {
			return err
		}
	}
	return nil
}

func Parse(args []string) (generator.Options, []string, error) {
	op := generator.Options{}

	fs := flag.NewFlagSet("sqlabble", flag.ExitOnError)
	fs.Usage = func() {
		name := args[0]
		fmt.Fprintf(os.Stderr, `%s is a code generation tool that implements a method that returns a table or column to a struct.

Usage:

  %s [flags] [glob]

Flags:

`, name, name)
		fs.PrintDefaults()
		fmt.Fprintf(os.Stderr, `
Examples:

  %s ./*.go
  %s ./**/*.go
  %s -suffix _gen ./**/*.go
`)
	}
	fs.StringVar(&op.Suffix, "suffix", "_sqlabble", "suffix of the file to be generated")
	if err := fs.Parse(args[1:]); err != nil {
		return op, nil, err
	}

	patterns := fs.Args()
	if len(patterns) == 0 {
		patterns = []string{"./*.go"}
{'fraction_non_alphanumeric': 0.17661795407098121, 'fraction_numerical': 0.0029227557411273487, 'mean_word_length': 3.317117117117117, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '726914', 'n_tokens_mistral': 988, 'n_tokens_neox': 939, 'n_words': 251}