layouts/shortcodes/command-group.html
{{/* Command Group shortcode - displays all commands for a specific command group Parameters: - group (required): The command group name (e.g., "hash", "sorted-set", "string") - title (optional): Custom title for the foldout (defaults to " commands") - show_link (optional): Whether to include a link to the filtered commands page (default: false) - url_group (optional): Override group name for the URL (useful when data group differs from URL filter) Usage: command-group group="hash" command-group group="sorted-set" title="Sorted set commands" show_link=true command-group group="module" url_group="vector_set" title="Vector set commands" show_link=true */}} {{ $group := .Get "group" }} {{ $title := .Get "title" }} {{ $showLink := .Get "show_link" | default false }} {{ $urlGroup := .Get "url_group" | default $group }} {{/* Validate required parameter */}} {{ if not $group }} {{ errorf "command-group shortcode requires 'group' parameter" }} {{ end }} {{/* Normalize group for comparison */}} {{ $groupLower := lower $group }} {{/* Generate default title if not provided */}} {{ if not $title }} {{ $title = printf "%s commands" (title (replace $groupLower "-" " ")) }} {{ end }} {{/* Merge all command data sources */}} {{ $allCommands := dict }} {{ with site.Data.commands_core }} {{ range $name, $cmd := . }} {{ $allCommands = merge $allCommands (dict $name $cmd) }} {{ end }} {{ end }} {{ with site.Data.commands_redisearch }} {{ range $name, $cmd := . }} {{ $allCommands = merge $allCommands (dict $name $cmd) }} {{ end }} {{ end }} {{ with site.Data.commands_redisjson }} {{ range $name, $cmd := . }} {{ $allCommands = merge $allCommands (dict $name $cmd) }} {{ end }} {{ end }} {{ with site.Data.commands_redistimeseries }} {{ range $name, $cmd := . }} {{ $allCommands = merge $allCommands (dict $name $cmd) }} {{ end }} {{ end }} {{ with site.Data.commands_redisbloom }} {{ range $name, $cmd := . }} {{ $allCommands = merge $allCommands (dict $name $cmd) }} {{ end }} {{ end }} {{/* Filter commands by group */}} {{ $matchedCommands := slice }} {{ range $name, $cmd := $allCommands }} {{ if and $cmd.group (eq (lower $cmd.group) $groupLower) }} {{ $matchedCommands = $matchedCommands | append (dict "name" $name "data" $cmd) }} {{ end }} {{ end }} {{/* Sort commands alphabetically by name */}} {{ $sortedCommands := sort $matchedCommands "name" }} {{/* Generate unique ID for this instance */}} {{ $uniqueId := printf "cmd-group-%s-%d" $groupLower (now.UnixNano) }} {{/* Render the foldout */}} {{ if gt (len $sortedCommands) 0 }}
{{ $title }} {{ if $showLink }} [(view reference, {{ len $sortedCommands }} commands)]({{%20absURL%20(printf) {{ else }} ({{ len $sortedCommands }} commands) {{ end }}
{{ range $sortedCommands }} {{ $cmdName := .name }} {{ $cmdData := .data }} {{ $cmdSlug := lower (replace $cmdName " " "-") }} - [
{{ $cmdName }} {{ with $cmdData.since }} v{{ . }} {{ end }} {{ with $cmdData.acl_categories }} {{ range . }} {{ . }} {{ end }} {{ end }} {{ with $cmdData.summary }} {{ . }} {{ end }} {{ with $cmdData.complexity }} {{ . }} {{ end }} ]({{%20absURL%20(printf) {{ end }}
{{ else }}
No commands found for group: {{ $group }}
{{ end }}