From 2b2c37ea473e6aab0d23472b057b00212f96818d Mon Sep 17 00:00:00 2001 From: Jonathan Matthews Date: Fri, 23 Aug 2024 22:20:50 +0100 Subject: [PATCH] docs/reference: add modules tag to cmd/cue texts This adds the "modules" tag to the appropriate cmd/cue help text pages. Also: rename a "functional" regular field to be a hidden field in /content/docs/reference/command/commands.cue so that cue {vet,export} content/docs/reference/command/commands.cue can work without complaining about non-concrete values. Preview-Path: /docs/reference/command/cue-help-mod-edit/ Preview-Path: /docs/reference/command/cue-help-mod-fix/ Preview-Path: /docs/reference/command/cue-help-mod-get/ Preview-Path: /docs/reference/command/cue-help-mod-init/ Preview-Path: /docs/reference/command/cue-help-mod-publish/ Preview-Path: /docs/reference/command/cue-help-mod-resolve/ Preview-Path: /docs/reference/command/cue-help-mod-tidy/ Preview-Path: /docs/reference/command/cue-help-mod/ Preview-Path: /docs/reference/command/cue-help-modules/ Preview-Path: /docs/reference/command/cue-help-registryconfig/ Signed-off-by: Jonathan Matthews Change-Id: I234409c1f1a3b305a34a7cab39a3f4b510bf96b8 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cuelang.org/+/1199971 Reviewed-by: Paul Jolly TryBot-Result: CUEcueckoo --- content/docs/reference/command/commands.cue | 33 +++++++++++++++++-- .../reference/command/cue-help-login/en.md | 1 + .../reference/command/cue-help-mod-edit/en.md | 1 + .../reference/command/cue-help-mod-fix/en.md | 1 + .../reference/command/cue-help-mod-get/en.md | 1 + .../reference/command/cue-help-mod-init/en.md | 1 + .../command/cue-help-mod-publish/en.md | 1 + .../command/cue-help-mod-resolve/en.md | 1 + .../reference/command/cue-help-mod-tidy/en.md | 1 + .../docs/reference/command/cue-help-mod/en.md | 1 + .../reference/command/cue-help-modules/en.md | 1 + .../command/cue-help-registryconfig/en.md | 1 + .../reference/command/cue-help-login/index.md | 1 + .../command/cue-help-mod-edit/index.md | 1 + .../command/cue-help-mod-fix/index.md | 1 + .../command/cue-help-mod-get/index.md | 1 + .../command/cue-help-mod-init/index.md | 1 + .../command/cue-help-mod-publish/index.md | 1 + .../command/cue-help-mod-resolve/index.md | 1 + .../command/cue-help-mod-tidy/index.md | 1 + .../reference/command/cue-help-mod/index.md | 1 + .../command/cue-help-modules/index.md | 1 + .../command/cue-help-registryconfig/index.md | 1 + site.cue | 3 +- 24 files changed, 55 insertions(+), 3 deletions(-) diff --git a/content/docs/reference/command/commands.cue b/content/docs/reference/command/commands.cue index dbd780991..0f58044f3 100644 --- a/content/docs/reference/command/commands.cue +++ b/content/docs/reference/command/commands.cue @@ -6,7 +6,7 @@ import ( ) contentRoot: "content/docs/reference/command" -cuePathBase: { +_cuePathBase: { _input: string // align this path's prefix with contentRoot content: docs: reference: command: (_input): page: {} @@ -17,6 +17,8 @@ cuePathBase: { title!: string execCmd!: string cuePath!: string + tagSet!: [string]: true // true is chosen over top purely to produce concrete data. + tagList!: [...] // oldDir is used to populate the page-level "aliases" front matter key, // temporarily, until our logs show us that few enough inbound links reach @@ -31,7 +33,9 @@ cue: [SubCommand=string]: #CueCommand & { execCmd: *"cue help \(SubCommand)" | _ title: *"cue help \(SubCommand)" | _ oldDir: *"cue-\(_dirSuffix)" | _ - cuePath: json.Marshal(cuePathBase & { + tagSet: *{} | _ + tagList: [for tag, _ in tagSet {tag}] + cuePath: json.Marshal(_cuePathBase & { _input: dir }) } @@ -46,6 +50,31 @@ cue: { } } +// Hugo page tags +cue: { + [_]: tagSet: "cue command": _ + // This can't be reduced to a more general comprehension over the keys of the + // tags.cue field because https://cuelang.org/issues/2013 strikes. + [or(tags.cue.modules)]: tagSet: modules: _ +} +// Ensure that all tagged pages exist as actual pages. +tags: "cue": [_]: [...or([for command, _ in cue {command}])] +tags: cue: { + modules: [ + "login", + "mod", + "mod edit", + "mod fix", + "mod get", + "mod init", + "mod publish", + "mod resolve", + "mod tidy", + "modules", + "registryconfig", + ] +} + // All commands cue: { cue: _ diff --git a/content/docs/reference/command/cue-help-login/en.md b/content/docs/reference/command/cue-help-login/en.md index 4226957d4..3ad5f32cf 100644 --- a/content/docs/reference/command/cue-help-login/en.md +++ b/content/docs/reference/command/cue-help-login/en.md @@ -5,6 +5,7 @@ aliases: ["/docs/reference/cli/cue-login/"] weight: 1000 tags: - cue command +- modules --- {{{with script "en" "cue cli help text"}}} diff --git a/content/docs/reference/command/cue-help-mod-edit/en.md b/content/docs/reference/command/cue-help-mod-edit/en.md index d57e052a1..e80a03e33 100644 --- a/content/docs/reference/command/cue-help-mod-edit/en.md +++ b/content/docs/reference/command/cue-help-mod-edit/en.md @@ -5,6 +5,7 @@ aliases: ["/docs/reference/cli/cue-mod-edit/"] weight: 1000 tags: - cue command +- modules --- {{{with script "en" "cue cli help text"}}} diff --git a/content/docs/reference/command/cue-help-mod-fix/en.md b/content/docs/reference/command/cue-help-mod-fix/en.md index a07d5c889..97adbe94d 100644 --- a/content/docs/reference/command/cue-help-mod-fix/en.md +++ b/content/docs/reference/command/cue-help-mod-fix/en.md @@ -5,6 +5,7 @@ aliases: ["/docs/reference/cli/cue-mod-fix/"] weight: 1000 tags: - cue command +- modules --- {{{with script "en" "cue cli help text"}}} diff --git a/content/docs/reference/command/cue-help-mod-get/en.md b/content/docs/reference/command/cue-help-mod-get/en.md index 219decb59..2021d0990 100644 --- a/content/docs/reference/command/cue-help-mod-get/en.md +++ b/content/docs/reference/command/cue-help-mod-get/en.md @@ -5,6 +5,7 @@ aliases: ["/docs/reference/cli/cue-mod-get/"] weight: 1000 tags: - cue command +- modules --- {{{with script "en" "cue cli help text"}}} diff --git a/content/docs/reference/command/cue-help-mod-init/en.md b/content/docs/reference/command/cue-help-mod-init/en.md index 5b142244c..01ed92305 100644 --- a/content/docs/reference/command/cue-help-mod-init/en.md +++ b/content/docs/reference/command/cue-help-mod-init/en.md @@ -5,6 +5,7 @@ aliases: ["/docs/reference/cli/cue-mod-init/"] weight: 1000 tags: - cue command +- modules --- {{{with script "en" "cue cli help text"}}} diff --git a/content/docs/reference/command/cue-help-mod-publish/en.md b/content/docs/reference/command/cue-help-mod-publish/en.md index 41cd9a112..7ad47973f 100644 --- a/content/docs/reference/command/cue-help-mod-publish/en.md +++ b/content/docs/reference/command/cue-help-mod-publish/en.md @@ -5,6 +5,7 @@ aliases: ["/docs/reference/cli/cue-mod-publish/"] weight: 1000 tags: - cue command +- modules --- {{{with script "en" "cue cli help text"}}} diff --git a/content/docs/reference/command/cue-help-mod-resolve/en.md b/content/docs/reference/command/cue-help-mod-resolve/en.md index 8784b49fe..6f6280a4d 100644 --- a/content/docs/reference/command/cue-help-mod-resolve/en.md +++ b/content/docs/reference/command/cue-help-mod-resolve/en.md @@ -5,6 +5,7 @@ aliases: ["/docs/reference/cli/cue-mod-resolve/"] weight: 1000 tags: - cue command +- modules --- {{{with script "en" "cue cli help text"}}} diff --git a/content/docs/reference/command/cue-help-mod-tidy/en.md b/content/docs/reference/command/cue-help-mod-tidy/en.md index 66558549a..eec480368 100644 --- a/content/docs/reference/command/cue-help-mod-tidy/en.md +++ b/content/docs/reference/command/cue-help-mod-tidy/en.md @@ -5,6 +5,7 @@ aliases: ["/docs/reference/cli/cue-mod-tidy/"] weight: 1000 tags: - cue command +- modules --- {{{with script "en" "cue cli help text"}}} diff --git a/content/docs/reference/command/cue-help-mod/en.md b/content/docs/reference/command/cue-help-mod/en.md index d8513856f..af2d3ce1d 100644 --- a/content/docs/reference/command/cue-help-mod/en.md +++ b/content/docs/reference/command/cue-help-mod/en.md @@ -5,6 +5,7 @@ aliases: ["/docs/reference/cli/cue-mod/"] weight: 1000 tags: - cue command +- modules --- {{{with script "en" "cue cli help text"}}} diff --git a/content/docs/reference/command/cue-help-modules/en.md b/content/docs/reference/command/cue-help-modules/en.md index b1c89257c..bc454cea1 100644 --- a/content/docs/reference/command/cue-help-modules/en.md +++ b/content/docs/reference/command/cue-help-modules/en.md @@ -5,6 +5,7 @@ aliases: ["/docs/reference/cli/cue-modules/"] weight: 1000 tags: - cue command +- modules --- {{{with script "en" "cue cli help text"}}} diff --git a/content/docs/reference/command/cue-help-registryconfig/en.md b/content/docs/reference/command/cue-help-registryconfig/en.md index e6e8a81b7..c8f4043db 100644 --- a/content/docs/reference/command/cue-help-registryconfig/en.md +++ b/content/docs/reference/command/cue-help-registryconfig/en.md @@ -5,6 +5,7 @@ aliases: ["/docs/reference/cli/cue-registryconfig/"] weight: 1000 tags: - cue command +- modules --- {{{with script "en" "cue cli help text"}}} diff --git a/hugo/content/en/docs/reference/command/cue-help-login/index.md b/hugo/content/en/docs/reference/command/cue-help-login/index.md index 9fa598937..ee77c6329 100644 --- a/hugo/content/en/docs/reference/command/cue-help-login/index.md +++ b/hugo/content/en/docs/reference/command/cue-help-login/index.md @@ -5,6 +5,7 @@ aliases: ["/docs/reference/cli/cue-login/"] weight: 1000 tags: - cue command +- modules --- ```text { title="TERMINAL" type="terminal" codeToCopy="Y3VlIGhlbHAgbG9naW4=" } diff --git a/hugo/content/en/docs/reference/command/cue-help-mod-edit/index.md b/hugo/content/en/docs/reference/command/cue-help-mod-edit/index.md index e91531703..813a0e8d9 100644 --- a/hugo/content/en/docs/reference/command/cue-help-mod-edit/index.md +++ b/hugo/content/en/docs/reference/command/cue-help-mod-edit/index.md @@ -5,6 +5,7 @@ aliases: ["/docs/reference/cli/cue-mod-edit/"] weight: 1000 tags: - cue command +- modules --- ```text { title="TERMINAL" type="terminal" codeToCopy="Y3VlIGhlbHAgbW9kIGVkaXQ=" } diff --git a/hugo/content/en/docs/reference/command/cue-help-mod-fix/index.md b/hugo/content/en/docs/reference/command/cue-help-mod-fix/index.md index 44a7f2b4c..27aee2c48 100644 --- a/hugo/content/en/docs/reference/command/cue-help-mod-fix/index.md +++ b/hugo/content/en/docs/reference/command/cue-help-mod-fix/index.md @@ -5,6 +5,7 @@ aliases: ["/docs/reference/cli/cue-mod-fix/"] weight: 1000 tags: - cue command +- modules --- ```text { title="TERMINAL" type="terminal" codeToCopy="Y3VlIGhlbHAgbW9kIGZpeA==" } diff --git a/hugo/content/en/docs/reference/command/cue-help-mod-get/index.md b/hugo/content/en/docs/reference/command/cue-help-mod-get/index.md index 68234652d..d0e665d0e 100644 --- a/hugo/content/en/docs/reference/command/cue-help-mod-get/index.md +++ b/hugo/content/en/docs/reference/command/cue-help-mod-get/index.md @@ -5,6 +5,7 @@ aliases: ["/docs/reference/cli/cue-mod-get/"] weight: 1000 tags: - cue command +- modules --- ```text { title="TERMINAL" type="terminal" codeToCopy="Y3VlIGhlbHAgbW9kIGdldA==" } diff --git a/hugo/content/en/docs/reference/command/cue-help-mod-init/index.md b/hugo/content/en/docs/reference/command/cue-help-mod-init/index.md index e047aae61..940274999 100644 --- a/hugo/content/en/docs/reference/command/cue-help-mod-init/index.md +++ b/hugo/content/en/docs/reference/command/cue-help-mod-init/index.md @@ -5,6 +5,7 @@ aliases: ["/docs/reference/cli/cue-mod-init/"] weight: 1000 tags: - cue command +- modules --- ```text { title="TERMINAL" type="terminal" codeToCopy="Y3VlIGhlbHAgbW9kIGluaXQ=" } diff --git a/hugo/content/en/docs/reference/command/cue-help-mod-publish/index.md b/hugo/content/en/docs/reference/command/cue-help-mod-publish/index.md index 4ed8308bd..3eb83439b 100644 --- a/hugo/content/en/docs/reference/command/cue-help-mod-publish/index.md +++ b/hugo/content/en/docs/reference/command/cue-help-mod-publish/index.md @@ -5,6 +5,7 @@ aliases: ["/docs/reference/cli/cue-mod-publish/"] weight: 1000 tags: - cue command +- modules --- ```text { title="TERMINAL" type="terminal" codeToCopy="Y3VlIGhlbHAgbW9kIHB1Ymxpc2g=" } diff --git a/hugo/content/en/docs/reference/command/cue-help-mod-resolve/index.md b/hugo/content/en/docs/reference/command/cue-help-mod-resolve/index.md index b6bb9a5bf..8d5ca8c7b 100644 --- a/hugo/content/en/docs/reference/command/cue-help-mod-resolve/index.md +++ b/hugo/content/en/docs/reference/command/cue-help-mod-resolve/index.md @@ -5,6 +5,7 @@ aliases: ["/docs/reference/cli/cue-mod-resolve/"] weight: 1000 tags: - cue command +- modules --- ```text { title="TERMINAL" type="terminal" codeToCopy="Y3VlIGhlbHAgbW9kIHJlc29sdmU=" } diff --git a/hugo/content/en/docs/reference/command/cue-help-mod-tidy/index.md b/hugo/content/en/docs/reference/command/cue-help-mod-tidy/index.md index 2fed8ca6b..93e759fa3 100644 --- a/hugo/content/en/docs/reference/command/cue-help-mod-tidy/index.md +++ b/hugo/content/en/docs/reference/command/cue-help-mod-tidy/index.md @@ -5,6 +5,7 @@ aliases: ["/docs/reference/cli/cue-mod-tidy/"] weight: 1000 tags: - cue command +- modules --- ```text { title="TERMINAL" type="terminal" codeToCopy="Y3VlIGhlbHAgbW9kIHRpZHk=" } diff --git a/hugo/content/en/docs/reference/command/cue-help-mod/index.md b/hugo/content/en/docs/reference/command/cue-help-mod/index.md index 959a45ef2..4ba384431 100644 --- a/hugo/content/en/docs/reference/command/cue-help-mod/index.md +++ b/hugo/content/en/docs/reference/command/cue-help-mod/index.md @@ -5,6 +5,7 @@ aliases: ["/docs/reference/cli/cue-mod/"] weight: 1000 tags: - cue command +- modules --- ```text { title="TERMINAL" type="terminal" codeToCopy="Y3VlIGhlbHAgbW9k" } diff --git a/hugo/content/en/docs/reference/command/cue-help-modules/index.md b/hugo/content/en/docs/reference/command/cue-help-modules/index.md index af06be4d7..a3ff0cc6a 100644 --- a/hugo/content/en/docs/reference/command/cue-help-modules/index.md +++ b/hugo/content/en/docs/reference/command/cue-help-modules/index.md @@ -5,6 +5,7 @@ aliases: ["/docs/reference/cli/cue-modules/"] weight: 1000 tags: - cue command +- modules --- ```text { title="TERMINAL" type="terminal" codeToCopy="Y3VlIGhlbHAgbW9kdWxlcw==" } diff --git a/hugo/content/en/docs/reference/command/cue-help-registryconfig/index.md b/hugo/content/en/docs/reference/command/cue-help-registryconfig/index.md index aa3053490..c6a13cd90 100644 --- a/hugo/content/en/docs/reference/command/cue-help-registryconfig/index.md +++ b/hugo/content/en/docs/reference/command/cue-help-registryconfig/index.md @@ -5,6 +5,7 @@ aliases: ["/docs/reference/cli/cue-registryconfig/"] weight: 1000 tags: - cue command +- modules --- ```text { title="TERMINAL" type="terminal" codeToCopy="Y3VlIGhlbHAgcmVnaXN0cnljb25maWc=" } diff --git a/site.cue b/site.cue index 8cf476eec..4cfec59ef 100644 --- a/site.cue +++ b/site.cue @@ -3,6 +3,7 @@ package site import ( "list" "strings" + "encoding/yaml" "github.com/cue-lang/cuelang.org/internal/ci" "github.com/cue-lang/cuelang.org/internal/ci/base" @@ -337,7 +338,7 @@ template: ci.#writefs & { aliases: ["/docs/reference/cli/\#(cmd.oldDir)/"] weight: 1000 tags: - - cue command + \#(strings.TrimSuffix(yaml.Marshal(cmd.tagList), "\n")) --- {{{with script "en" "cue cli help text"}}}