Skip to content

Commit 472f1cb

Browse files
committed
docs/reference: present pre-release cue-fix help text
This bumps the on-page version of the cue-fix help text to the site's pre-release, in order to make the --exp flag visible when linked from pages that mention language experiments. A custom info block tells the reader that this flag requires a pre-release (but not the command itself). The hideIntroduction flag is renamed to genIntroduction (with an inverted meaning), to avoid any confusion that might otherwise come from its use alongside a custom "introduction" field. Preview-Path: /docs/reference/command/cue-help-fix/ Signed-off-by: Jonathan Matthews <[email protected]> Change-Id: Id46a6e6ebe9c0a01b3955eca93c68b868582c91b Reviewed-on: https://cue.gerrithub.io/c/cue-lang/cuelang.org/+/1225082 Reviewed-by: Paul Jolly <[email protected]> TryBot-Result: CUEcueckoo <[email protected]>
1 parent 4055e8d commit 472f1cb

File tree

4 files changed

+88
-24
lines changed

4 files changed

+88
-24
lines changed

content/docs/reference/command/commands.cue

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,24 @@ _cuePathBase: {
2020
// TODO: use site.cue's canonical data for these values (from the keys of
2121
// versions["cue"]) when a solution to the panic captured at
2222
// https://cuelang.org/cl/1209140 is available.
23-
cueVersion!: "latest" | "tip" | "prerelease"
24-
experimental!: bool
25-
introduction!: string
26-
hideIntroduction!: bool
23+
cueVersion!: "latest" | "tip" | "prerelease"
24+
experimental!: bool
25+
introduction!: string
26+
genIntroduction!: bool
2727
tagSet!: [string]: true // true is chosen over top purely to produce concrete data.
2828
tagList!: [...]
2929
relatedCommands!: [...string]
3030
}
3131

3232
cue: [SubCommand=string]: #CueCommand & {
33-
_dirSuffix: strings.Replace(SubCommand, " ", "-", -1)
34-
dir: *"cue-help-\(_dirSuffix)" | _
35-
execCmd: *"cue help \(SubCommand)" | _
36-
title: *"cue help \(SubCommand)" | _
37-
cueVersion: *"latest" | _
38-
experimental: *false | _
39-
introduction: *"" | _
40-
hideIntroduction: *false | _
33+
_dirSuffix: strings.Replace(SubCommand, " ", "-", -1)
34+
dir: *"cue-help-\(_dirSuffix)" | _
35+
execCmd: *"cue help \(SubCommand)" | _
36+
title: *"cue help \(SubCommand)" | _
37+
cueVersion: *"latest" | _
38+
experimental: *false | _
39+
introduction: *"" | _
40+
genIntroduction: *true | _
4141
tagSet: *{} | _
4242
tagList: [for tag, _ in tagSet {tag}]
4343
relatedCommands: *[] | _
@@ -67,20 +67,31 @@ cue: {
6767
cueVersion: "prerelease"
6868
// Consider uncommenting this line, instead of removing this command's
6969
// customisation entirely.
70-
//hideIntroduction: true
70+
//genIntroduction: false
71+
}
72+
73+
fix: {
74+
cueVersion: "prerelease"
75+
genIntroduction: false
76+
introduction: """
77+
{{<info>}}
78+
The `--exp` flag is only available in a recent CUE
79+
[pre-release]({{<relref"docs/introduction/installation#download-an-official-cue-binary">}}).
80+
{{</info>}}
81+
"""
7182
}
7283
}
7384

7485
// Introduce experimental and unreleased commands.
7586
cue: [_]: {
76-
experimental: _
77-
cueVersion: _
78-
hideIntroduction: _
87+
experimental: _
88+
cueVersion: _
89+
genIntroduction: _
7990
let tip = (cueVersion == "tip")
8091
let prerelease = (cueVersion == "prerelease")
8192
let unreleased = tip || prerelease
8293

83-
if !hideIntroduction && (experimental || unreleased) {
94+
if genIntroduction && (experimental || unreleased) {
8495
introduction: strings.Join([
8596
"{{<info>}}",
8697
if tip {"This command is not yet available in the latest CUE release."},

content/docs/reference/command/cue-help-fix/en.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@ tags:
66
- cue command
77
---
88
{{{with _script_ "en" "HIDDEN: access required CUE version"}}}
9-
export PATH=/cues/$CUELANG_CUE_LATEST:$PATH
9+
export PATH=/cues/$CUELANG_CUE_PRERELEASE:$PATH
1010
{{{end}}}
11-
11+
{{<info>}}
12+
The `--exp` flag is only available in a recent CUE
13+
[pre-release]({{<relref"docs/introduction/installation#download-an-official-cue-binary">}}).
14+
{{</info>}}
1215
{{{with script "en" "cue cli help text"}}}
1316
cue help fix
1417
{{{end}}}

content/docs/reference/command/cue-help-fix/gen_cache.cue

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ package site
88
page: {
99
cache: {
1010
multi_step: {
11-
hash: "1CAKPEHL6VR50EPJ0FIAMBG44SO2B0LTSMT0BARDHFOAFC4KF980===="
12-
scriptHash: "EAN3P2JQ3V6QSU6V62E80MQMHOEE0B7JE4513535222V3DLB6VEG===="
11+
hash: "776459IJO5M7C45APUNTGDPC6J2PK6RJ2C4VDB0I4AL42O3FEIOG===="
12+
scriptHash: "HU2032H2F80QL7EUHCPGTA81DI8EBK53KKJH0UHUN9B3R87QRE7G===="
1313
steps: [{
1414
doc: ""
15-
cmd: "export PATH=/cues/v0.14.2:$PATH"
15+
cmd: "export PATH=/cues/v0.15.0-alpha.3:$PATH"
1616
exitCode: 0
1717
output: ""
1818
}, {
@@ -26,11 +26,34 @@ package site
2626
2727
Without any packages, fix applies to all files within a module.
2828
29+
30+
Experiments
31+
32+
CUE experiments are features that are not yet part of the stable language but
33+
are being tested for future inclusion. Some of these may introduce backwards
34+
incompatible changes for which there is a cue fix. The --exp flag is used to
35+
change a file or package to use the new, experimental semantics. Experiments
36+
are enabled on a per-file basis.
37+
38+
For example, to enable the "explicitopen" experiment for all files in a package,
39+
you would run:
40+
41+
\tcue fix . --exp=explicitopen
42+
43+
For this to succeed, your current language version must support the experiment.
44+
If an experiment has not yet been accepted for the current version, an
45+
@experiment attribute is added in each affected file to mark the transition as
46+
complete.
47+
48+
The special value --exp=all enables all experimental features that apply to the
49+
current version.
50+
2951
Usage:
3052
cue fix [packages] [flags]
3153
3254
Flags:
33-
-f, --force rewrite even when there are errors
55+
--exp strings list of experiments to port
56+
-f, --force rewrite even when there are errors
3457
3558
Global Flags:
3659
-E, --all-errors print all available errors

hugo/content/en/docs/reference/command/cue-help-fix/index.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ weight: 1000
55
tags:
66
- cue command
77
---
8+
{{<info>}}
9+
The `--exp` flag is only available in a recent CUE
10+
[pre-release]({{<relref"docs/introduction/installation#download-an-official-cue-binary">}}).
11+
{{</info>}}
812
````text { title="TERMINAL" type="terminal" codeToCopy="Y3VlIGhlbHAgZml4" }
913
$ cue help fix
1014
Fix finds CUE programs that use old syntax and old APIs and rewrites them to use newer ones.
@@ -13,11 +17,34 @@ to your program.
1317
1418
Without any packages, fix applies to all files within a module.
1519
20+
21+
Experiments
22+
23+
CUE experiments are features that are not yet part of the stable language but
24+
are being tested for future inclusion. Some of these may introduce backwards
25+
incompatible changes for which there is a cue fix. The --exp flag is used to
26+
change a file or package to use the new, experimental semantics. Experiments
27+
are enabled on a per-file basis.
28+
29+
For example, to enable the "explicitopen" experiment for all files in a package,
30+
you would run:
31+
32+
cue fix . --exp=explicitopen
33+
34+
For this to succeed, your current language version must support the experiment.
35+
If an experiment has not yet been accepted for the current version, an
36+
@experiment attribute is added in each affected file to mark the transition as
37+
complete.
38+
39+
The special value --exp=all enables all experimental features that apply to the
40+
current version.
41+
1642
Usage:
1743
cue fix [packages] [flags]
1844
1945
Flags:
20-
-f, --force rewrite even when there are errors
46+
--exp strings list of experiments to port
47+
-f, --force rewrite even when there are errors
2148
2249
Global Flags:
2350
-E, --all-errors print all available errors

0 commit comments

Comments
 (0)