(fs caddycmd.Flags)
| 26 | } |
| 27 | |
| 28 | func cmdPHPCLI(fs caddycmd.Flags) (int, error) { |
| 29 | args := os.Args[2:] |
| 30 | if len(args) < 1 { |
| 31 | return 1, errors.New("the path to the PHP script is required") |
| 32 | } |
| 33 | |
| 34 | if frankenphp.EmbeddedAppPath != "" { |
| 35 | if _, err := os.Stat(args[0]); err != nil { |
| 36 | args[0] = filepath.Join(frankenphp.EmbeddedAppPath, args[0]) |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | var status int |
| 41 | if len(args) >= 2 && args[0] == "-r" { |
| 42 | status = frankenphp.ExecutePHPCode(args[1]) |
| 43 | } else { |
| 44 | status = frankenphp.ExecuteScriptCLI(args[0], args) |
| 45 | } |
| 46 | |
| 47 | os.Exit(status) |
| 48 | |
| 49 | return status, nil |
| 50 | } |
nothing calls this directly
no test coverage detected