mirror of
https://github.com/php/frankenphp.git
synced 2026-03-23 16:42:13 +01:00
feat(docs): add autocompletion docs (#2010)
Co-authored-by: henderkes <m@pyc.ac>
This commit is contained in:
committed by
GitHub
parent
bd8f0c2be6
commit
097563d262
2
.github/workflows/windows.yaml
vendored
2
.github/workflows/windows.yaml
vendored
@@ -193,7 +193,7 @@ jobs:
|
||||
- name: Build FrankenPHP
|
||||
run: |
|
||||
$customVersion = "FrankenPHP $env:FRANKENPHP_VERSION PHP $env:PHP_VERSION Caddy"
|
||||
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'"
|
||||
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'"
|
||||
working-directory: frankenphp\caddy\frankenphp
|
||||
|
||||
- name: Create Directory
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,5 +1,6 @@
|
||||
/caddy/frankenphp/Build
|
||||
/caddy/frankenphp/frankenphp
|
||||
/caddy/frankenphp/frankenphp.exe
|
||||
/dist
|
||||
/github_conf
|
||||
/internal/testserver/testserver
|
||||
|
||||
@@ -118,7 +118,7 @@ ENV CGO_LDFLAGS="-L/usr/local/lib -lssl -lcrypto -lreadline -largon2 -lcurl -lon
|
||||
|
||||
WORKDIR /go/src/app/caddy/frankenphp
|
||||
RUN GOBIN=/usr/local/bin \
|
||||
../../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 && \
|
||||
../../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 && \
|
||||
setcap cap_net_bind_service=+ep /usr/local/bin/frankenphp && \
|
||||
cp Caddyfile /etc/frankenphp/Caddyfile && \
|
||||
frankenphp version && \
|
||||
|
||||
@@ -123,7 +123,7 @@ ENV CGO_LDFLAGS="-lssl -lcrypto -lreadline -largon2 -lcurl -lonig -lz $PHP_LDFLA
|
||||
|
||||
WORKDIR /go/src/app/caddy/frankenphp
|
||||
RUN GOBIN=/usr/local/bin \
|
||||
../../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 && \
|
||||
../../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 && \
|
||||
setcap cap_net_bind_service=+ep /usr/local/bin/frankenphp && \
|
||||
([ -z "${NO_COMPRESS}" ] && upx --best /usr/local/bin/frankenphp || true) && \
|
||||
frankenphp version && \
|
||||
|
||||
@@ -348,3 +348,78 @@ docker run -v $PWD:/app/public \
|
||||
-p 80:80 -p 443:443 -p 443:443/udp \
|
||||
dunglas/frankenphp
|
||||
```
|
||||
|
||||
## Shell Completion
|
||||
|
||||
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.
|
||||
|
||||
### Bash
|
||||
|
||||
To load completions in your current shell session:
|
||||
|
||||
```console
|
||||
source <(frankenphp completion bash)
|
||||
```
|
||||
|
||||
To load completions for every new session, run:
|
||||
|
||||
**Linux:**
|
||||
|
||||
```console
|
||||
frankenphp completion bash > /usr/share/bash-completion/completions/frankenphp
|
||||
```
|
||||
|
||||
**macOS:**
|
||||
|
||||
```console
|
||||
frankenphp completion bash > $(brew --prefix)/share/bash-completion/completions/frankenphp
|
||||
```
|
||||
|
||||
### Zsh
|
||||
|
||||
If shell completion is not already enabled in your environment, you will need to enable it. You can execute the following once:
|
||||
|
||||
```console
|
||||
echo "autoload -U compinit; compinit" >> ~/.zshrc
|
||||
```
|
||||
|
||||
To load completions for each session, execute once:
|
||||
|
||||
```console
|
||||
frankenphp completion zsh > "${fpath[1]}/_frankenphp"
|
||||
```
|
||||
|
||||
You will need to start a new shell for this setup to take effect.
|
||||
|
||||
### Fish
|
||||
|
||||
To load completions in your current shell session:
|
||||
|
||||
```console
|
||||
frankenphp completion fish | source
|
||||
```
|
||||
|
||||
To load completions for every new session, execute once:
|
||||
|
||||
```console
|
||||
frankenphp completion fish > ~/.config/fish/completions/frankenphp.fish
|
||||
```
|
||||
|
||||
### PowerShell
|
||||
|
||||
To load completions in your current shell session:
|
||||
|
||||
```powershell
|
||||
frankenphp completion powershell | Out-String | Invoke-Expression
|
||||
```
|
||||
|
||||
To load completions for every new session, execute once:
|
||||
|
||||
```powershell
|
||||
frankenphp completion powershell | Out-File -FilePath (Join-Path (Split-Path $PROFILE) "frankenphp.ps1")
|
||||
Add-Content -Path $PROFILE -Value '. (Join-Path (Split-Path $PROFILE) "frankenphp.ps1")'
|
||||
```
|
||||
|
||||
You will need to start a new shell for this setup to take effect.
|
||||
|
||||
You will need to start a new shell for this setup to take effect.
|
||||
|
||||
@@ -342,3 +342,78 @@ docker run -v $PWD:/app/public \
|
||||
-p 80:80 -p 443:443 -p 443:443/udp \
|
||||
dunglas/frankenphp
|
||||
```
|
||||
|
||||
## Autocomplétion Shell
|
||||
|
||||
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.
|
||||
|
||||
### Bash
|
||||
|
||||
Pour charger l'autocomplétion dans votre session shell actuelle :
|
||||
|
||||
```console
|
||||
source <(frankenphp completion bash)
|
||||
```
|
||||
|
||||
Pour charger l'autocomplétion à chaque nouvelle session, exécutez :
|
||||
|
||||
**Linux :**
|
||||
|
||||
```console
|
||||
frankenphp completion bash > /usr/share/bash-completion/completions/frankenphp
|
||||
```
|
||||
|
||||
**macOS :**
|
||||
|
||||
```console
|
||||
frankenphp completion bash > $(brew --prefix)/share/bash-completion/completions/frankenphp
|
||||
```
|
||||
|
||||
### Zsh
|
||||
|
||||
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 :
|
||||
|
||||
```console
|
||||
echo "autoload -U compinit; compinit" >> ~/.zshrc
|
||||
```
|
||||
|
||||
Pour charger l'autocomplétion à chaque session, exécutez une fois :
|
||||
|
||||
```console
|
||||
frankenphp completion zsh > "${fpath[1]}/_frankenphp"
|
||||
```
|
||||
|
||||
Vous devrez démarrer un nouveau shell pour que cette configuration prenne effet.
|
||||
|
||||
### Fish
|
||||
|
||||
Pour charger l'autocomplétion dans votre session shell actuelle :
|
||||
|
||||
```console
|
||||
frankenphp completion fish | source
|
||||
```
|
||||
|
||||
Pour charger l'autocomplétion à chaque nouvelle session, exécutez une fois :
|
||||
|
||||
```console
|
||||
frankenphp completion fish > ~/.config/fish/completions/frankenphp.fish
|
||||
```
|
||||
|
||||
### PowerShell
|
||||
|
||||
Pour charger l'autocomplétion dans votre session shell actuelle :
|
||||
|
||||
```powershell
|
||||
frankenphp completion powershell | Out-String | Invoke-Expression
|
||||
```
|
||||
|
||||
Pour charger l'autocomplétion à chaque nouvelle session, exécutez une fois :
|
||||
|
||||
```powershell
|
||||
frankenphp completion powershell | Out-File -FilePath (Join-Path (Split-Path $PROFILE) "frankenphp.ps1")
|
||||
Add-Content -Path $PROFILE -Value '. (Join-Path (Split-Path $PROFILE) "frankenphp.ps1")'
|
||||
```
|
||||
|
||||
Vous devrez démarrer un nouveau shell pour que cette configuration prenne effet.
|
||||
|
||||
Vous devrez ensuite démarrer un nouveau shell pour que cette configuration prenne effet.
|
||||
|
||||
Reference in New Issue
Block a user