Skip to content

Commit cedfb49

Browse files
authored
fix(generate): Correct help text for push flag (#1908)
Updates help text to refer to the correct '-push' flag instead of the non-existent '-push-config'. Fixes #1726 With this fix, `go run ./cmd/librarian generate -h` shows: ``` jinseop@jinseop:/workspace/librarian$ go run ./cmd/librarian generate -h Specify the API repository root and the path within it for the API to generate. Optional flags can be specified to use a non-default language repository, and to indicate whether or not to build the generated library. The generate command handles both onboarding new libraries and regenerating existing ones. The behavior is determined by the provided flags. **Onboarding a new library:** To configure and generate a new library, specify both the "-api" and "-library" flags. This process involves: 1. Running the "configure" command in the language container to set up the repository. 2. Adding the new library's configuration to the ".librarian/state.yaml" file. 3. Proceeding with the generation steps below. **Regenerating existing libraries:** If only "-api" or "-library" is specified, the command regenerates that single, existing library. If neither flag is provided, it regenerates all libraries listed in ".librarian/state.yaml". The generation process for an existing library involves delegating to the language container's 'generate' command. After generation, the tool cleans the destination directory and copies the new files into place, according to the configuration in '.librarian/state.yaml'. If the '--build' flag is specified, the 'build' command is also executed. **Output:** After generation, if the "-push" flag is provided, the changes are committed to a new branch, and a pull request is created. Otherwise, the changes are left in the local working tree for inspection. Usage: librarian generate -source=<api-root> -api=<api-path> [flags] Flags: -api string path to the API to be configured/generated (e.g., google/cloud/functions/v2) -api-source string location of googleapis repository. If undefined, googleapis will be cloned to the output -branch string remote branch to use with the code repository for cloning and pull requests. (default "main") -build whether to build the generated code -host-mount string a mount point from Docker host and within the Docker. The format is {host-dir}:{local-dir}. -image string Container image to run for subcommands. Defaults to the image in the pipeline state. -library string The ID of a single library to update. This is repo-specific and defined in the state.yaml -output string Working directory root. When this is not specified, a working directory will be created in /tmp. -push whether to push the generated code -repo string Code repository where the generated code will reside. Can be a remote in the format of a remote URL such as https://github.com/{owner}/{repo} or a local file path like /path/to/repo. Both absolute and relative paths are supported. If not specified, will try to detect if the current working directory is configured as a language repository. 2025/09/03 12:26:47 flag: help requested exit status 1 ```
1 parent af7b19e commit cedfb49

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

internal/librarian/generate.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ new files into place, according to the configuration in '.librarian/state.yaml'.
5858
If the '--build' flag is specified, the 'build' command is also executed.
5959
6060
**Output:**
61-
After generation, if a push configuration is provided (e.g., via the "-push-config" flag), the changes
62-
are committed to a new branch, and a pull request is created. Otherwise, the changes are left in the
63-
local working tree for inspection.`,
61+
After generation, if the "-push" flag is provided, the changes are committed to a new branch, and
62+
a pull request is created. Otherwise, the changes are left in the local working tree for
63+
inspection.`,
6464
Run: func(ctx context.Context, cfg *config.Config) error {
6565
runner, err := newGenerateRunner(cfg)
6666
if err != nil {

0 commit comments

Comments
 (0)