(_ caddycmd.Flags)
| 29 | } |
| 30 | |
| 31 | func 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 | } |
nothing calls this directly
no test coverage detected