Skip to content

Commit 4be588f

Browse files
authored
docs(librarian): bring more consistent styling to flag documentation
Updates: #207
1 parent 0d3b7eb commit 4be588f

File tree

1 file changed

+47
-18
lines changed

1 file changed

+47
-18
lines changed

internal/librarian/flags.go

Lines changed: 47 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,60 +21,89 @@ import (
2121
)
2222

2323
func addFlagAPI(fs *flag.FlagSet, cfg *config.Config) {
24-
fs.StringVar(&cfg.API, "api", "", "path to the API to be configured/generated (e.g., google/cloud/functions/v2)")
24+
fs.StringVar(&cfg.API, "api", "",
25+
`Relative path to the API to be configured/generated (e.g., google/cloud/functions/v2).
26+
Must be specified when generating a new library.`)
2527
}
2628

2729
func addFlagAPISource(fs *flag.FlagSet, cfg *config.Config) {
28-
fs.StringVar(&cfg.APISource, "api-source", "", "location of googleapis repository. If undefined, googleapis will be cloned to the output")
30+
fs.StringVar(&cfg.APISource, "api-source", "",
31+
`The location of an API specification repository.
32+
Can be a remote URL or a local file path. If not specified, googleapis is the
33+
default and will be cloned.`)
2934
}
3035

3136
func addFlagBuild(fs *flag.FlagSet, cfg *config.Config) {
32-
fs.BoolVar(&cfg.Build, "build", false, "whether to build the generated code")
37+
fs.BoolVar(&cfg.Build, "build", false,
38+
`If true, Librarian will build each generated library by invoking the
39+
language-specific container.`)
3340
}
3441

3542
func addFlagCommit(fs *flag.FlagSet, cfg *config.Config) {
36-
fs.BoolVar(&cfg.Commit, "commit", false, "whether to create a commit for a release")
43+
fs.BoolVar(&cfg.Commit, "commit", false,
44+
`If true, librarian will create a commit for the release but not create
45+
a pull request. This flag is ignored if push is set to true.`)
3746
}
3847

3948
func addFlagHostMount(fs *flag.FlagSet, cfg *config.Config) {
4049
defaultValue := ""
41-
fs.StringVar(&cfg.HostMount, "host-mount", defaultValue, "a mount point from Docker host and within the Docker. The format is {host-dir}:{local-dir}.")
50+
fs.StringVar(&cfg.HostMount, "host-mount", defaultValue,
51+
`For use when librarian is running in a container. A mapping of a
52+
directory from the host to the container, in the format
53+
<host-mount>:<local-mount>.`)
4254
}
4355

4456
func addFlagImage(fs *flag.FlagSet, cfg *config.Config) {
45-
fs.StringVar(&cfg.Image, "image", "", "Container image to run for subcommands. Defaults to the image in the pipeline state.")
57+
fs.StringVar(&cfg.Image, "image", "",
58+
`Language specific image used to invoke code generation and releasing.
59+
If not specified, the image configured in the state.yaml is used.`)
4660
}
4761

4862
func addFlagLibrary(fs *flag.FlagSet, cfg *config.Config) {
49-
fs.StringVar(&cfg.Library, "library", "", "The ID of a single library to update. This is repo-specific and defined in the state.yaml")
63+
fs.StringVar(&cfg.Library, "library", "",
64+
`The library ID to generate or release (e.g. google-cloud-secretmanager-v1).
65+
This corresponds to a releasable language unit.`)
5066
}
5167

5268
func addFlagLibraryVersion(fs *flag.FlagSet, cfg *config.Config) {
53-
fs.StringVar(&cfg.LibraryVersion, "library-version", "", "the library version to release. Requires the --library flag to be specified.")
69+
fs.StringVar(&cfg.LibraryVersion, "library-version", "",
70+
`Overrides the automatic semantic version calculation and forces a specific
71+
version for a library. Requires the --library flag to be specified.`)
5472
}
5573

5674
func addFlagPR(fs *flag.FlagSet, cfg *config.Config) {
57-
fs.StringVar(&cfg.PullRequest, "pr", "", "a pull request to operate on. It should be in the format of a uri https://github.com/{owner}/{repo}/pull/{number}. If not specified, will search for all merged pull requests with the label `release:pending` in the last 30 days.")
75+
fs.StringVar(&cfg.PullRequest, "pr", "",
76+
`The URL of a pull request to operate on.
77+
It should be in the format of https://github.com/{owner}/{repo}/pull/{number}.
78+
If not specified, will search for all merged pull requests with the label
79+
"release:pending" in the last 30 days.`)
5880
}
5981

6082
func addFlagPush(fs *flag.FlagSet, cfg *config.Config) {
61-
fs.BoolVar(&cfg.Push, "push", false, "whether to push the generated code")
83+
fs.BoolVar(&cfg.Push, "push", false,
84+
`If true, Librarian will create a commit and a pull request for the changes.
85+
A GitHub token with push access must be provided via the
86+
SDK_LIBRARIAN_GITHUB_TOKEN environment variable.`)
6287
}
6388

6489
func addFlagRepo(fs *flag.FlagSet, cfg *config.Config) {
6590
fs.StringVar(&cfg.Repo, "repo", "",
66-
`Code repository where the generated code will reside.
67-
Can be a remote in the format of a remote URL such as
68-
https://github.com/{owner}/{repo} or a local file path like
69-
/path/to/repo. Both absolute and relative paths are supported.
70-
If not specified, will try to detect if the current working
71-
directory is configured as a language repository.`)
91+
`Code repository where the generated code will reside. Can be a remote
92+
in the format of a remote URL such as https://github.com/{owner}/{repo} or a
93+
local file path like /path/to/repo. Both absolute and relative paths are
94+
supported. If not specified, will try to detect if the current working directory
95+
is configured as a language repository.`)
7296
}
7397

7498
func addFlagBranch(fs *flag.FlagSet, cfg *config.Config) {
75-
fs.StringVar(&cfg.Branch, "branch", "main", "remote branch to use with the code repository for cloning and pull requests.")
99+
fs.StringVar(&cfg.Branch, "branch", "main",
100+
`The branch to use with remote code repositories. This is used to specify
101+
which branch to clone and which branch to use as the base for a pull
102+
request.`)
76103
}
77104

78105
func addFlagWorkRoot(fs *flag.FlagSet, cfg *config.Config) {
79-
fs.StringVar(&cfg.WorkRoot, "output", "", "Working directory root. When this is not specified, a working directory will be created in /tmp.")
106+
fs.StringVar(&cfg.WorkRoot, "output", "",
107+
`Working directory root. When this is not specified, a working directory
108+
will be created in /tmp.`)
80109
}

0 commit comments

Comments
 (0)