Skip to content

Commit 5542044

Browse files
feat: allow omitting value with the --watch flag of php-server (#1595)
1 parent 52b6531 commit 5542044

4 files changed

Lines changed: 9 additions & 6 deletions

File tree

caddy/php-server.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
func init() {
2929
caddycmd.RegisterCommand(caddycmd.Command{
3030
Name: "php-server",
31-
Usage: "[--domain <example.com>] [--root <path>] [--listen <addr>] [--worker /path/to/worker.php<,nb-workers>] [--watch <paths...>] [--access-log] [--debug] [--no-compress] [--mercure]",
31+
Usage: "[--domain=<example.com>] [--root=<path>] [--listen=<addr>] [--worker=/path/to/worker.php<,nb-workers>] [--watch[=<glob-pattern>]]... [--access-log] [--debug] [--no-compress] [--mercure]",
3232
Short: "Spins up a production-ready PHP server",
3333
Long: `
3434
A simple but production-ready PHP server. Useful for quick deployments,
@@ -47,11 +47,14 @@ For more advanced use cases, see https://github.com/dunglas/frankenphp/blob/main
4747
cmd.Flags().StringP("root", "r", "", "The path to the root of the site")
4848
cmd.Flags().StringP("listen", "l", "", "The address to which to bind the listener")
4949
cmd.Flags().StringArrayP("worker", "w", []string{}, "Worker script")
50-
cmd.Flags().StringArrayP("watch", "", []string{}, "Directory to watch for file changes")
50+
cmd.Flags().StringArray("watch", []string{}, "Glob pattern of directories and files to watch for changes")
5151
cmd.Flags().BoolP("access-log", "a", false, "Enable the access log")
5252
cmd.Flags().BoolP("debug", "v", false, "Enable verbose debug logs")
5353
cmd.Flags().BoolP("mercure", "m", false, "Enable the built-in Mercure.rocks hub")
54-
cmd.Flags().BoolP("no-compress", "", false, "Disable Zstandard, Brotli and Gzip compression")
54+
cmd.Flags().Bool("no-compress", false, "Disable Zstandard, Brotli and Gzip compression")
55+
56+
cmd.Flags().Lookup("watch").NoOptDefVal = defaultWatchPattern
57+
5558
cmd.RunE = caddycmd.WrapCommandFuncForCobra(cmdPHPServer)
5659
},
5760
})

docs/fr/worker.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Il est également possible de [redémarrer le worker en cas de changement de fic
3232
La commande suivante déclenchera un redémarrage si un fichier se terminant par `.php` dans le répertoire `/path/to/your/app/` ou ses sous-répertoires est modifié :
3333

3434
```console
35-
frankenphp php-server --worker /path/to/your/worker/script.php --watch "/path/to/your/app/**/*.php"
35+
frankenphp php-server --worker /path/to/your/worker/script.php --watch="/path/to/your/app/**/*.php"
3636
```
3737

3838
## Runtime Symfony

docs/ru/worker.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ frankenphp php-server --worker /path/to/your/worker/script.php
3232
Следующая команда выполнит перезапуск, если будет изменён любой файл с расширением `.php` в директории `/path/to/your/app/` или её поддиректориях:
3333

3434
```console
35-
frankenphp php-server --worker /path/to/your/worker/script.php --watch "/path/to/your/app/**/*.php"
35+
frankenphp php-server --worker /path/to/your/worker/script.php --watch="/path/to/your/app/**/*.php"
3636
```
3737

3838
## Symfony Runtime

docs/worker.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ It's also possible to [restart the worker on file changes](config.md#watching-fo
3232
The following command will trigger a restart if any file ending in `.php` in the `/path/to/your/app/` directory or subdirectories is modified:
3333

3434
```console
35-
frankenphp php-server --worker /path/to/your/worker/script.php --watch "/path/to/your/app/**/*.php"
35+
frankenphp php-server --worker /path/to/your/worker/script.php --watch="/path/to/your/app/**/*.php"
3636
```
3737

3838
## Symfony Runtime

0 commit comments

Comments
 (0)