Skip to content

Commit 56679ae

Browse files
committed
cli: alternative alias rendering
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
1 parent 36d3f62 commit 56679ae

File tree

1 file changed

+32
-28
lines changed

1 file changed

+32
-28
lines changed

layouts/_default/cli.html

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,39 @@
1313
{{ .Scratch.Set "subheadings" slice }}
1414
{{ partial "breadcrumbs.html" . }}
1515
<article class="DocSearch-content prose max-w-none dark:prose-invert">
16-
{{ if ne .LinkTitle .Title }}
17-
{{/*
18-
we use linkTitle for surfacing popular aliases like "docker run"
19-
if linkTitle is set, use both alias and canonical cmd as title
20-
*/}}
21-
<h1 class="scroll-mt-36">{{ .LinkTitle }}<span
22-
class="text-gray-light dark:text-gray-dark"> ({{ .Title }})</span>
23-
</h1>
24-
{{ else }}
2516
<h1 class="scroll-mt-36">{{ .Title }}</h1>
26-
{{ end }}
27-
{{ $data.short | .RenderString (dict "display" "block") }}
17+
<table>
18+
<tbody>
19+
{{ with $data.short }}
20+
<tr>
21+
<th class="text-left w-32">Description</th>
22+
<td>{{ . }}</th>
23+
</tr>
24+
{{ end }}
25+
{{ with $data.usage }}
26+
<tr>
27+
<th class="text-left w-32">Usage</th>
28+
<td><code>{{ . }}</code></td>
29+
</tr>
30+
{{ end }}
31+
{{ with $data.aliases }}
32+
{{ $aliases := strings.Replace . (fmt.Printf "%s, " page.Title) "" }}
33+
<tr>
34+
<th class="text-left w-32 flex items-center gap-2">
35+
<span>Aliases</span>
36+
{{ partial "tooltip.html" "An alias is a short or memorable alternative for a longer command." }}
37+
</th>
38+
<td>
39+
<div class="flex gap-3">
40+
{{ range (strings.Split $aliases ", ") }}
41+
<code>{{ . }}</code>
42+
{{ end }}
43+
</div>
44+
</td>
45+
</tr>
46+
{{ end }}
47+
</tbody>
48+
</table>
2849
{{ .Content }}
2950
{{ if $data.deprecated }}
3051
<blockquote class="warning">
@@ -60,23 +81,6 @@ <h1 class="scroll-mt-36">{{ .Title }}</h1>
6081
This command works with the Swarm orchestrator.
6182
</p>
6283
{{ end }}
63-
{{ with $data.usage }}
64-
{{ $heading := dict "level" 2 "text" "Usage" }}
65-
{{ partial "heading.html" $heading }}
66-
{{ $.Scratch.Add "headings" $heading }}
67-
{{ highlight (strings.Replace . "\t" "") "console" }}
68-
{{ end }}
69-
{{ with $data.aliases }}
70-
{{ $heading := dict "level" 2 "text" "Aliases" }}
71-
{{ partial "heading.html" $heading }}
72-
{{ $aliases := strings.Split . ", " }}
73-
<p>The following commands are equivalent and redirect here:</p>
74-
<ul>
75-
{{ range $aliases }}
76-
<li><code>{{ . }}</code></li>
77-
{{ end }}
78-
</ul>
79-
{{ end }}
8084
{{ with $data.long }}
8185
{{ $heading := dict "level" 2 "text" "Description" }}
8286
{{ partial "heading.html" $heading }}

0 commit comments

Comments
 (0)