Skip to content

Commit

Permalink
update package-commands wiki
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlatwe committed Mar 4, 2021
1 parent 2c253c3 commit e551be4
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions wiki/pages/Package-Commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -346,14 +346,23 @@ like *env.append*, but prepends the environment variable instead.
### ephemerals
*Dict-like object*

if intersects(ephemerals.get("foo.cli", "1"), "1"):
env.PATH.append("{rot}/bin")
if intersects(ephemerals.get("foo.cli", default="foo.cli-1"), "1"):
env.PATH.append("{root}/bin")

A dict representing the list of ephemerals in the resolved environment. Each item is a
string (the full request, eg `.foo.cli-1`), keyed by the ephemeral package name. Note
that you do **not** include the leading `.` when getting items from the `ephemerals`
object.

Noted that the default value of `ephemerals.get` method should be a full request string so the `intersects`
can work as expect.

Alternatively, you can use `ephemerals.get_range` to get `VersionRange` object, which may provide
a bit intuitive way to interact with `intersects`.

if intersects(ephemerals.get_range("foo.cli", "1"), "1"):
env.PATH.append("{root}/bin")

### error
*Function*

Expand Down Expand Up @@ -433,6 +442,20 @@ This request would yield the following *request* object:
"corelib": "!corelib-1.4.4"
}

To use with `intersects`:

if intersects(request.get("foo.cli", default="foo.cli-1"), "1"):
env.PATH.append("{root}/bin")

Noted that the default value of `request.get` method should be a full request string so the `intersects`
can work as expect.

Alternatively, you can use `request.get_range` to get `VersionRange` object, which may provide
a bit intuitive way to interact with `intersects`.

if intersects(request.get_range("foo.cli", "1"), "1"):
env.PATH.append("{root}/bin")

> [[media/icons/info.png]] If multiple requests are present that refer to the same package, the
request is combined ahead of time. In other words, if requests *foo-4+* and *foo-<6* were both
present, the single request *foo-4+<6* would be present in the *request* object.
Expand Down

0 comments on commit e551be4

Please sign in to comment.