Skip to content

Commit e9bc377

Browse files
committed
cmd/cue: add information about import paths to cue help inputs
The current help doesn't mention anything about modules, amongst other issues. Fixes #3184 Signed-off-by: Roger Peppe <[email protected]> Change-Id: Ib6b174eb6b2c74d49daedc226590968e45546026 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1198080 Reviewed-by: Daniel Martí <[email protected]> Unity-Result: CUE porcuepine <[email protected]> TryBot-Result: CUEcueckoo <[email protected]>
1 parent 682ff0e commit e9bc377

File tree

1 file changed

+32
-10
lines changed

1 file changed

+32
-10
lines changed

cmd/cue/cmd/help.go

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -119,21 +119,43 @@ the package in the current directory, provided there is a single
119119
named package in this directory.
120120
121121
CUE packages are specified as an import path. An import path
122-
that is a rooted path --one that begins with a "." or ".."
123-
element-- is interpreted as a file system path and denotes the
122+
that begins with a "." or ".." element is a relative import path,
123+
is interpreted as a file system path, and denotes the
124124
package instance in that directory.
125125
126-
Otherwise, the import path P denotes an external package found
127-
in cue.mod/{pkg|gen|usr}/P.
126+
Otherwise, the import path P is absolute and denotes a package that
127+
may be external, usually found in an external registry. It may also
128+
refer to a package in cue.mod/{pkg|gen|usr}/P - this is legacy
129+
behavior that might be removed at a later date.
128130
129-
An import path may contain one or more "..." to match any
130-
subdirectory: pkg/... matches all packages below pkg, including
131-
pkg itself, while foo/.../bar matches all directories named bar
132-
within foo. In all cases, directories containing cue.mod
133-
directories are excluded from the result.
131+
An absolute import path is of the form P or P@vN where vN is the major
132+
version of the module containing the package. An import path is mapped
133+
to a registry location by consulting cue.mod/module.cue and the
134+
registry configuration (see "cue help modules" and "cue help
135+
registryconfig" for more details).
136+
137+
An import may contain a ":name" suffix to indicate a specific
138+
package to load within a given path. It is necessary to specify this
139+
when there is more than one package at the path.
140+
141+
For example, the following import path specifies a package
142+
named "other" in some external module with major version v1.
143+
144+
foo.example/bar/baz@v1:other
145+
146+
A local import path may contain one or more "..." to match any
147+
subdirectory: pkg/... matches all packages below pkg, including pkg
148+
itself, while foo/.../bar matches all directories named bar within
149+
foo. In all cases, directories containing cue.mod directories are
150+
excluded from the result. "..." is not currently supported in external
151+
import paths.
134152
135153
Directory and file names that begin with "." or "_" are ignored,
136-
unless explicitly listed as inputs.
154+
unless explicitly listed as inputs. File with names ending "_tool.cue"
155+
are ignored unless running "cue cmd" and they are in packages
156+
explicitly mentioned on the command line. Files with names ending
157+
"_test.cue" are ignored for the time being; they are reserved for
158+
future testing functionality.
137159
138160
A package may also be specified as a list of .cue files.
139161
The special symbol '-' denotes stdin or stdout and defaults to

0 commit comments

Comments
 (0)