cli: Fix template rendering (oops)

This commit is contained in:
Matthew Holt 2022-08-01 14:01:55 -06:00
parent d6733bc63d
commit 46a24de506
No known key found for this signature in database
GPG key ID: 2A349DD577D586A5

View file

@ -295,9 +295,9 @@ A body may be given in 3 ways: a flag, a final (and unnamed) argument to the com
Variable | Description
---------|-------------
`{{.N}}` | Server number
`{{.Port}}` | Listener port
`{{.Address}}` | Listener address
`.N` | Server number
`.Port` | Listener port
`.Address` | Listener address
#### Examples
@ -309,8 +309,7 @@ HTTP response with a body:
<pre><code class="cmd bash">caddy respond "Hello, world!"</code></pre>
Multiple servers and templates:
```plain
$ caddy respond --listen :2000-2004 "I'm server {{.N}} on port {{.Port}}"
<pre><code class="cmd"><b>$ caddy respond --listen :2000-2004 "{{printf "I'm server {{.N}} on port {{.Port}}"}}"</b>
Server address: [::]:2000
Server address: [::]:2001
@ -318,15 +317,14 @@ Server address: [::]:2002
Server address: [::]:2003
Server address: [::]:2004
$ curl 127.0.0.1:2002
I'm server 2 on port 2002
```
<b>$ curl 127.0.0.1:2002</b>
I'm server 2 on port 2002</pre></code>
Pipe in a maintenance page:
<pre><code class="cmd bash">cat maintenance.html | caddy respond \
--listen :80 \
--status 503 \
--header "Content-Type: text/html" \
--listen :80</code></pre>
--header "Content-Type: text/html"</code></pre>
### `caddy reverse-proxy`