Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions docs/rules/placeholder_repository_ctx_docs.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Repository Context Functions

This document describes functions available on the `repository_ctx` object.

## download_and_extract

`repository_ctx.download_and_extract(url, output="", sha256="", type="", strip_prefix="", strip_components=0)`

Downloads a file from the given URL, extracts it, and optionally applies a strip prefix or strips leading path components.

| Parameter | Description |
| :--------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `url` | A string, or a list of strings, representing the URLs of the archives. |
| `output` | Directory to extract to. |
| `sha256` | The SHA256 checksum of the archive. |
| `type` | The archive type. If not specified, the type is inferred from the file extension. |
| `strip_prefix` | Strips the given prefix from the extracted files. For compatibility, this parameter may also be used under the deprecated name `stripPrefix`. Only one of `strip_prefix` or `strip_components` can be used. |
| `strip_components` | `int`, default `0`. Strip the given number of leading components from file paths on extraction. For example, if an archive contains `foo/bar/baz.txt` and `strip_components = 1`, then `bar/baz.txt` will be extracted. Only one of `strip_components` or `strip_prefix` can be used. Must be non-negative. |

## extract

`repository_ctx.extract(archive, output="", strip_prefix="", strip_components=0, type="")`

Extracts an archive.

| Parameter | Description |
| :--------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `archive` | The archive to extract. |
| `output` | Directory to extract to. ------------------------------------------------------------------------ |
| `strip_prefix` | Strips the given prefix from the extracted files. For compatibility, this parameter may also be used under the deprecated name `stripPrefix`. Only one of `strip_prefix` or `strip_components` can be used. |
| `strip_components` | `int`, default `0`. Strip the given number of leading components from file paths on extraction. For example, if an archive contains `foo/bar/baz.txt` and `strip_components = 1`, then `bar/baz.txt` will be extracted. Only one of `strip_components` or `strip_prefix` can be used. Must be non-negative. |
| `type` | The archive type. If not specified, the type is inferred from the file extension. |
32 changes: 32 additions & 0 deletions site/en/rules/placeholder_repository_ctx_docs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Repository Context Functions

This document describes functions available on the `repository_ctx` object.

## download_and_extract

`repository_ctx.download_and_extract(url, output="", sha256="", type="", strip_prefix="", strip_components=0)`

Downloads a file from the given URL, extracts it, and optionally applies a strip prefix or strips leading path components.

| Parameter | Description |
| :--------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `url` | A string, or a list of strings, representing the URLs of the archives. |
| `output` | Directory to extract to. |
| `sha256` | The SHA256 checksum of the archive. |
| `type` | The archive type. If not specified, the type is inferred from the file extension. |
| `strip_prefix` | Strips the given prefix from the extracted files. For compatibility, this parameter may also be used under the deprecated name `stripPrefix`. Only one of `strip_prefix` or `strip_components` can be used. |
| `strip_components` | `int`, default `0`. Strip the given number of leading components from file paths on extraction. For example, if an archive contains `foo/bar/baz.txt` and `strip_components = 1`, then `bar/baz.txt` will be extracted. Only one of `strip_components` or `strip_prefix` can be used. Must be non-negative. |

## extract

`repository_ctx.extract(archive, output="", strip_prefix="", strip_components=0, type="")`

Extracts an archive.

| Parameter | Description |
| :--------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `archive` | The archive to extract. |
| `output` | Directory to extract to. ------------------------------------------------------------------------ |
| `strip_prefix` | Strips the given prefix from the extracted files. For compatibility, this parameter may also be used under the deprecated name `stripPrefix`. Only one of `strip_prefix` or `strip_components` can be used. |
| `strip_components` | `int`, default `0`. Strip the given number of leading components from file paths on extraction. For example, if an archive contains `foo/bar/baz.txt` and `strip_components = 1`, then `bar/baz.txt` will be extracted. Only one of `strip_components` or `strip_prefix` can be used. Must be non-negative. |
| `type` | The archive type. If not specified, the type is inferred from the file extension. |
Loading