Skip to content

Commit 645e42a

Browse files
authored
fix: clarify doc and comment with commit and push flag (#2507)
Update doc and comment around --commit and --push, these flags work for both `generate` and `release` commands. Actual code is working as expected. Fixes #2495
1 parent c4bfc3f commit 645e42a

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

cmd/librarian/doc.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ Flags:
118118
Working directory root. When this is not specified, a working directory
119119
will be created in /tmp.
120120
-push
121-
If true, Librarian will create a commit and a pull request for the changes.
121+
If true, Librarian will create a commit,
122+
push and create a pull request for the changes.
122123
A GitHub token with push access must be provided via the
123124
LIBRARIAN_GITHUB_TOKEN environment variable.
124125
-repo string
@@ -193,7 +194,7 @@ Flags:
193194
which branch to clone and which branch to use as the base for a pull
194195
request. (default "main")
195196
-commit
196-
If true, librarian will create a commit for the release but not create
197+
If true, librarian will create a commit for the change but not create
197198
a pull request. This flag is ignored if push is set to true.
198199
-image string
199200
Language specific image used to invoke code generation and releasing.
@@ -208,7 +209,8 @@ Flags:
208209
Working directory root. When this is not specified, a working directory
209210
will be created in /tmp.
210211
-push
211-
If true, Librarian will create a commit and a pull request for the changes.
212+
If true, Librarian will create a commit,
213+
push and create a pull request for the changes.
212214
A GitHub token with push access must be provided via the
213215
LIBRARIAN_GITHUB_TOKEN environment variable.
214216
-repo string

doc/cli-commands.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ librarian generate [flags]
2020
| `-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. |
2121
| `-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. |
2222
| `-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. |
23+
| `-commit` | bool | No | Whether to commit the generated code change locally. |
24+
| `-push` | bool | No | Whether to push the change and create a pull request in GitHub. |
2425

2526
## Example
2627

internal/librarian/flags.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ language-specific container.`)
4141

4242
func addFlagCommit(fs *flag.FlagSet, cfg *config.Config) {
4343
fs.BoolVar(&cfg.Commit, "commit", false,
44-
`If true, librarian will create a commit for the release but not create
44+
`If true, librarian will create a commit for the change but not create
4545
a pull request. This flag is ignored if push is set to true.`)
4646
}
4747

@@ -87,7 +87,8 @@ If not specified, will search for all merged pull requests with the label
8787

8888
func addFlagPush(fs *flag.FlagSet, cfg *config.Config) {
8989
fs.BoolVar(&cfg.Push, "push", false,
90-
fmt.Sprintf(`If true, Librarian will create a commit and a pull request for the changes.
90+
fmt.Sprintf(`If true, Librarian will create a commit,
91+
push and create a pull request for the changes.
9192
A GitHub token with push access must be provided via the
9293
%s environment variable.`, config.LibrarianGithubToken))
9394
}

0 commit comments

Comments
 (0)