mirror of
https://github.com/dunglas/frankenphp.git
synced 2026-04-23 00:37:20 +08:00
fix: php-cli flag parsing conflicts (#1559)
* Fixes flag parsing. * trigger * trigger * Fixes flag parsing. --------- Co-authored-by: Alliballibaba <alliballibaba@gmail.com>
This commit is contained in:
committed by
GitHub
parent
0d12a5162d
commit
c2390e7c3b
+3
-3
@@ -19,7 +19,7 @@ func init() {
|
||||
Long: `
|
||||
Executes a PHP script similarly to the CLI SAPI.`,
|
||||
CobraFunc: func(cmd *cobra.Command) {
|
||||
cmd.Flags().StringP("code", "r", "", "Execute PHP code directly without <?php ... ?> tags")
|
||||
cmd.DisableFlagParsing = true
|
||||
cmd.RunE = caddycmd.WrapCommandFuncForCobra(cmdPHPCLI)
|
||||
},
|
||||
})
|
||||
@@ -38,8 +38,8 @@ func cmdPHPCLI(fs caddycmd.Flags) (int, error) {
|
||||
}
|
||||
|
||||
var status int
|
||||
if evalCode := fs.String("code"); evalCode != "" {
|
||||
status = frankenphp.ExecutePHPCode(evalCode)
|
||||
if len(args) >= 2 && args[0] == "-r" {
|
||||
status = frankenphp.ExecutePHPCode(args[1])
|
||||
} else {
|
||||
status = frankenphp.ExecuteScriptCLI(args[0], args)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user