Skip to content

Commit 70b68d4

Browse files
authored
docs: add documentation for generate CLI command (#1763)
1 parent 4be588f commit 70b68d4

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

doc/cli-commands.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Generate Command
2+
3+
The `generate` command is used to generate client library code for a repository.
4+
5+
## Usage
6+
7+
```bash
8+
librarian generate [flags]
9+
```
10+
11+
## Flags
12+
13+
| Flag | Type | Required | Description |
14+
|----------------|---------|----------|-------------|
15+
| `-api` | string | No (Yes for onboarding) | Path to the API to be configured (e.g., `google/cloud/functions/v2`). |
16+
| `-api-source` | string | No | Location of the API repository. If undefined, googleapis will be cloned to the output. |
17+
| `-build` | bool | No | Whether to build the generated code after generation. |
18+
| `-host-mount` | string | No | A mount point from Docker host and within Docker. Format: `{host-dir}:{local-dir}`. |
19+
| `-image` | string | No | Language specific container image. Defaults to the image in the pipeline state. |
20+
| `-library` | string | No (Yes for onboarding) | The ID of a single library to update or onboard. If updating this should match the library ID in the state.yaml file. |
21+
| `-repo` | string | No | Code repository for the generated code. Can be a remote URL (e.g., `https://github.com/{owner}/{repo}`) or a local path. If not specified, will try to detect the current working directory as a language repository. |
22+
| `-output` | string | No | Working directory root. If not specified, a working directory will be created in `/tmp`. |
23+
| `-push` | bool | No | Whether to push the generated code and create a pull request. |
24+
25+
## Example
26+
27+
```bash
28+
librarian generate -repo=https://github.com/googleapis/your-repo -library=your-ilbrary-id -build -push
29+
```
30+
31+
## Behavior
32+
33+
- **Onboarding a new library:** Specify both `-api` and `-library` to configure and generate a new library.
34+
- **Regenerating an existing library:** Specify `-library` to regenerate a single library. If this flag is not provided, all libraries in `.librarian/state.yaml` are regenerated.

0 commit comments

Comments
 (0)