Skip to content

Commit 097563d

Browse files
feat(docs): add autocompletion docs (#2010)
Co-authored-by: henderkes <m@pyc.ac>
1 parent bd8f0c2 commit 097563d

File tree

6 files changed

+154
-3
lines changed

6 files changed

+154
-3
lines changed

.github/workflows/windows.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ jobs:
193193
- name: Build FrankenPHP
194194
run: |
195195
$customVersion = "FrankenPHP $env:FRANKENPHP_VERSION PHP $env:PHP_VERSION Caddy"
196-
go build -ldflags="-extldflags=-fuse-ld=lld -X 'github.com/caddyserver/caddy/v2.CustomVersion=$customVersion' -X 'github.com/caddyserver/caddy/v2/modules/caddyhttp.ServerHeader=FrankenPHP Caddy'"
196+
go build -ldflags="-extldflags=-fuse-ld=lld -X 'github.com/caddyserver/caddy/v2.CustomVersion=$customVersion' -X 'github.com/caddyserver/caddy/v2.CustomBinaryName=frankenphp' -X 'github.com/caddyserver/caddy/v2/modules/caddyhttp.ServerHeader=FrankenPHP Caddy'"
197197
working-directory: frankenphp\caddy\frankenphp
198198

199199
- name: Create Directory

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/caddy/frankenphp/Build
22
/caddy/frankenphp/frankenphp
3+
/caddy/frankenphp/frankenphp.exe
34
/dist
45
/github_conf
56
/internal/testserver/testserver

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ ENV CGO_LDFLAGS="-L/usr/local/lib -lssl -lcrypto -lreadline -largon2 -lcurl -lon
118118

119119
WORKDIR /go/src/app/caddy/frankenphp
120120
RUN GOBIN=/usr/local/bin \
121-
../../go.sh install -ldflags "-w -s -X 'github.com/caddyserver/caddy/v2.CustomVersion=FrankenPHP $FRANKENPHP_VERSION PHP $PHP_VERSION Caddy' -X 'github.com/caddyserver/caddy/v2/modules/caddyhttp.ServerHeader=FrankenPHP Caddy'" -buildvcs=true && \
121+
../../go.sh install -ldflags "-w -s -X 'github.com/caddyserver/caddy/v2.CustomVersion=FrankenPHP $FRANKENPHP_VERSION PHP $PHP_VERSION Caddy' -X 'github.com/caddyserver/caddy/v2.CustomBinaryName=frankenphp' -X 'github.com/caddyserver/caddy/v2/modules/caddyhttp.ServerHeader=FrankenPHP Caddy'" -buildvcs=true && \
122122
setcap cap_net_bind_service=+ep /usr/local/bin/frankenphp && \
123123
cp Caddyfile /etc/frankenphp/Caddyfile && \
124124
frankenphp version && \

alpine.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ ENV CGO_LDFLAGS="-lssl -lcrypto -lreadline -largon2 -lcurl -lonig -lz $PHP_LDFLA
123123

124124
WORKDIR /go/src/app/caddy/frankenphp
125125
RUN GOBIN=/usr/local/bin \
126-
../../go.sh install -ldflags "-w -s -extldflags '-Wl,-z,stack-size=0x80000' -X 'github.com/caddyserver/caddy/v2.CustomVersion=FrankenPHP $FRANKENPHP_VERSION PHP $PHP_VERSION Caddy' -X 'github.com/caddyserver/caddy/v2/modules/caddyhttp.ServerHeader=FrankenPHP Caddy'" -buildvcs=true && \
126+
../../go.sh install -ldflags "-w -s -extldflags '-Wl,-z,stack-size=0x80000' -X 'github.com/caddyserver/caddy/v2.CustomVersion=FrankenPHP $FRANKENPHP_VERSION PHP $PHP_VERSION Caddy' -X 'github.com/caddyserver/caddy/v2.CustomBinaryName=frankenphp' -X 'github.com/caddyserver/caddy/v2/modules/caddyhttp.ServerHeader=FrankenPHP Caddy'" -buildvcs=true && \
127127
setcap cap_net_bind_service=+ep /usr/local/bin/frankenphp && \
128128
([ -z "${NO_COMPRESS}" ] && upx --best /usr/local/bin/frankenphp || true) && \
129129
frankenphp version && \

docs/config.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,3 +348,78 @@ docker run -v $PWD:/app/public \
348348
-p 80:80 -p 443:443 -p 443:443/udp \
349349
dunglas/frankenphp
350350
```
351+
352+
## Shell Completion
353+
354+
FrankenPHP provides built-in shell completion support for Bash, Zsh, Fish, and PowerShell. This enables autocompletion for all commands (including custom commands like `php-server`, `php-cli`, and `extension-init`) and their flags.
355+
356+
### Bash
357+
358+
To load completions in your current shell session:
359+
360+
```console
361+
source <(frankenphp completion bash)
362+
```
363+
364+
To load completions for every new session, run:
365+
366+
**Linux:**
367+
368+
```console
369+
frankenphp completion bash > /usr/share/bash-completion/completions/frankenphp
370+
```
371+
372+
**macOS:**
373+
374+
```console
375+
frankenphp completion bash > $(brew --prefix)/share/bash-completion/completions/frankenphp
376+
```
377+
378+
### Zsh
379+
380+
If shell completion is not already enabled in your environment, you will need to enable it. You can execute the following once:
381+
382+
```console
383+
echo "autoload -U compinit; compinit" >> ~/.zshrc
384+
```
385+
386+
To load completions for each session, execute once:
387+
388+
```console
389+
frankenphp completion zsh > "${fpath[1]}/_frankenphp"
390+
```
391+
392+
You will need to start a new shell for this setup to take effect.
393+
394+
### Fish
395+
396+
To load completions in your current shell session:
397+
398+
```console
399+
frankenphp completion fish | source
400+
```
401+
402+
To load completions for every new session, execute once:
403+
404+
```console
405+
frankenphp completion fish > ~/.config/fish/completions/frankenphp.fish
406+
```
407+
408+
### PowerShell
409+
410+
To load completions in your current shell session:
411+
412+
```powershell
413+
frankenphp completion powershell | Out-String | Invoke-Expression
414+
```
415+
416+
To load completions for every new session, execute once:
417+
418+
```powershell
419+
frankenphp completion powershell | Out-File -FilePath (Join-Path (Split-Path $PROFILE) "frankenphp.ps1")
420+
Add-Content -Path $PROFILE -Value '. (Join-Path (Split-Path $PROFILE) "frankenphp.ps1")'
421+
```
422+
423+
You will need to start a new shell for this setup to take effect.
424+
425+
You will need to start a new shell for this setup to take effect.

docs/fr/config.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,3 +342,78 @@ docker run -v $PWD:/app/public \
342342
-p 80:80 -p 443:443 -p 443:443/udp \
343343
dunglas/frankenphp
344344
```
345+
346+
## Autocomplétion Shell
347+
348+
FrankenPHP fournit un support d'autocomplétion intégré pour Bash, Zsh, Fish et PowerShell. Cela permet l'autocomplétion de toutes les commandes (y compris les commandes personnalisées comme `php-server`, `php-cli` et `extension-init`) ainsi que leurs options.
349+
350+
### Bash
351+
352+
Pour charger l'autocomplétion dans votre session shell actuelle :
353+
354+
```console
355+
source <(frankenphp completion bash)
356+
```
357+
358+
Pour charger l'autocomplétion à chaque nouvelle session, exécutez :
359+
360+
**Linux :**
361+
362+
```console
363+
frankenphp completion bash > /usr/share/bash-completion/completions/frankenphp
364+
```
365+
366+
**macOS :**
367+
368+
```console
369+
frankenphp completion bash > $(brew --prefix)/share/bash-completion/completions/frankenphp
370+
```
371+
372+
### Zsh
373+
374+
Si l'autocomplétion shell n'est pas déjà activée dans votre environnement, vous devrez l'activer. Vous pouvez exécuter la commande suivante une fois :
375+
376+
```console
377+
echo "autoload -U compinit; compinit" >> ~/.zshrc
378+
```
379+
380+
Pour charger l'autocomplétion à chaque session, exécutez une fois :
381+
382+
```console
383+
frankenphp completion zsh > "${fpath[1]}/_frankenphp"
384+
```
385+
386+
Vous devrez démarrer un nouveau shell pour que cette configuration prenne effet.
387+
388+
### Fish
389+
390+
Pour charger l'autocomplétion dans votre session shell actuelle :
391+
392+
```console
393+
frankenphp completion fish | source
394+
```
395+
396+
Pour charger l'autocomplétion à chaque nouvelle session, exécutez une fois :
397+
398+
```console
399+
frankenphp completion fish > ~/.config/fish/completions/frankenphp.fish
400+
```
401+
402+
### PowerShell
403+
404+
Pour charger l'autocomplétion dans votre session shell actuelle :
405+
406+
```powershell
407+
frankenphp completion powershell | Out-String | Invoke-Expression
408+
```
409+
410+
Pour charger l'autocomplétion à chaque nouvelle session, exécutez une fois :
411+
412+
```powershell
413+
frankenphp completion powershell | Out-File -FilePath (Join-Path (Split-Path $PROFILE) "frankenphp.ps1")
414+
Add-Content -Path $PROFILE -Value '. (Join-Path (Split-Path $PROFILE) "frankenphp.ps1")'
415+
```
416+
417+
Vous devrez démarrer un nouveau shell pour que cette configuration prenne effet.
418+
419+
Vous devrez ensuite démarrer un nouveau shell pour que cette configuration prenne effet.

0 commit comments

Comments
 (0)