MCPcopy Create free account
hub / github.com/pquerna/ffjson / main

Function main

ffjson.go:48–85  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

46var extRe = regexp.MustCompile(`(.*)(\.go)$`)
47
48func main() {
49 flag.Parse()
50 extra := flag.Args()
51
52 if len(extra) != 1 {
53 usage()
54 }
55
56 inputPath := filepath.ToSlash(extra[0])
57
58 var outputPath string
59 if outputPathFlag == nil || *outputPathFlag == "" {
60 outputPath = extRe.ReplaceAllString(inputPath, "${1}_ffjson.go")
61 } else {
62 outputPath = *outputPathFlag
63 }
64
65 var goCmd string
66 if goCmdFlag == nil || *goCmdFlag == "" {
67 goCmd = "go"
68 } else {
69 goCmd = *goCmdFlag
70 }
71
72 var importName string
73 if importNameFlag != nil && *importNameFlag != "" {
74 importName = *importNameFlag
75 }
76
77 err := generator.GenerateFiles(goCmd, inputPath, outputPath, importName, *forceRegenerateFlag, *resetFields)
78
79 if err != nil {
80 fmt.Fprintf(os.Stderr, "Error: %s:\n\n", err)
81 os.Exit(1)
82 }
83
84 println(outputPath)
85}

Callers

nothing calls this directly

Calls 1

usageFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…