MCPcopy Index your code
hub / github.com/php/frankenphp / cmdInitExtension

Function cmdInitExtension

caddy/extinit.go:31–48  ·  view source on GitHub ↗
(_ caddycmd.Flags)

Source from the content-addressed store, hash-verified

29}
30
31func cmdInitExtension(_ caddycmd.Flags) (int, error) {
32 if len(os.Args) < 3 {
33 return 1, errors.New("the path to the Go source is required")
34 }
35
36 sourceFile := os.Args[2]
37 baseName := extgen.SanitizePackageName(strings.TrimSuffix(filepath.Base(sourceFile), ".go"))
38
39 generator := extgen.Generator{BaseName: baseName, SourceFile: sourceFile, BuildDir: filepath.Dir(sourceFile)}
40
41 if err := generator.Generate(); err != nil {
42 return 1, err
43 }
44
45 log.Printf("PHP extension %q initialized successfully in directory %q", baseName, generator.BuildDir)
46
47 return 0, nil
48}

Callers

nothing calls this directly

Calls 2

GenerateMethod · 0.95
SanitizePackageNameFunction · 0.92

Tested by

no test coverage detected