Buckets:
| // Copyright (c) 2026 the Zuke contributors | |
| // SPDX-License-Identifier: MIT | |
| /** | |
| * The argv guards the logging and monitoring settings classes share. Internal | |
| * to the package. | |
| * | |
| * A token that starts with `-` is read by gcloud's argument parser as the | |
| * next flag: `gcloud logging read -severity=ERROR` exits 2 with | |
| * "unrecognized arguments". An option's own value is safe when it is sent as | |
| * one `--flag=value` token ({@link option}), but a positional operand is a | |
| * token of its own, so `policy("--project=other")` would have described a | |
| * policy in another project. {@link operand} refuses such a value. | |
| * | |
| * @module | |
| */ | |
| /** `--flag=value` as one token, so a value starting with `-` stays the value. */ | |
| export function option(flag: string, value: string | number): string { | |
| return `${flag}=${value}`; | |
| } | |
| /** | |
| * `value`, refused when gcloud would read it as a flag rather than a value; | |
| * `owner` names the caller, e.g. `GcloudTasks.monitoringPoliciesDescribe`. | |
| */ | |
| export function operand(owner: string, what: string, value: string): string { | |
| if (value.startsWith("-")) { | |
| throw new Error( | |
| `${owner}: the ${what} "${value}" starts with '-', which ` + | |
| "gcloud would read as a flag rather than a value. Refused.", | |
| ); | |
| } | |
| return value; | |
| } | |
| /** `value`, refused unless it is a finite number. */ | |
| export function finite(task: string, what: string, value: number): number { | |
| if (!Number.isFinite(value)) { | |
| throw new Error(`${task}: ${what} needs a finite number, got ${value}.`); | |
| } | |
| return value; | |
| } | |
Xet Storage Details
- Size:
- 1.54 kB
- Xet hash:
- 403c691bc3319ea4998880d8b50acf36c42eca4cf30906da04bf697b68ba9d31
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.