Skip to content

Commit 1ee71f9

Browse files
committed
Add documentation for commodore tool command group
1 parent 9f5d734 commit 1ee71f9

3 files changed

Lines changed: 116 additions & 2 deletions

File tree

commodore/cli/tool.py

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616
@options.pass_config
1717
@options.github_token
1818
def tool_group(config: Config, verbose: int, github_token: str):
19+
"""Commands to manage required external tools.
20+
21+
Currently, `helm`, jsonnet-bundler/`jb`, and `kustomize` are required
22+
external tools.
23+
"""
1924
config.update_verbosity(verbose)
2025
config.managed_tools = tools.load_state()
2126
config.github_token = github_token
@@ -32,6 +37,16 @@ def tool_group(config: Config, verbose: int, github_token: str):
3237
help="Query GitHub API to get latest version",
3338
)
3439
def tool_list(config: Config, verbose: int, github_token: str, version_check: bool):
40+
"""List the version, location and management state of the required external tools.
41+
42+
Currently, `helm`, jsonnet-bundler/`jb`, and `kustomize` are required
43+
external tools. By default, the command also queries the GitHub API to
44+
determine the latest available version of each tool and indicates whether an
45+
update is available.
46+
47+
Optionally, the command accepts a GitHub personal access token (PAT) to
48+
avoid running into the fairly strict unauthenticated GitHub rate limits.
49+
"""
3550
config.update_verbosity(verbose)
3651
config.github_token = github_token
3752
tools.list_tools(config, version_check)
@@ -45,12 +60,25 @@ def tool_list(config: Config, verbose: int, github_token: str, version_check: bo
4560
"--version",
4661
default=None,
4762
metavar="VERSION",
48-
help="A custom version to install for the requested tool (by default the latest version is installed)",
63+
help="A version to install for the requested tool. "
64+
+ "By default, the latest version is installed.",
4965
)
5066
@click.argument("tool")
5167
def tool_install(
5268
config: Config, verbose: int, tool: str, version: Optional[str], github_token: str
5369
):
70+
"""Install one of the required tools in `$XDG_CACHE_DIR/commodore/tools`.
71+
72+
The command will fail for tools which are already managed by Commodore.
73+
74+
By default, the command will install the latest available tool version. For
75+
`helm` and `kustomize`, the command downloads the official installation
76+
scripts and executes them with appropriate arguments. For `jb`, the command
77+
directly downloads the requested version from the GitHub release page.
78+
79+
Optionally, the command accepts a tool version to install. The command
80+
accepts versions prefixed with "v" and unprefixed versions.
81+
"""
5482
config.update_verbosity(verbose)
5583
config.github_token = github_token
5684
tools.install_tool(config, tool, version)
@@ -64,12 +92,26 @@ def tool_install(
6492
"--version",
6593
default=None,
6694
metavar="VERSION",
67-
help="A custom version to install for the requested tool (by default the latest version is installed)",
95+
help="A version to upgrade (or downgrade) to for the requested tool. "
96+
+ "By default, the tool is upgraded to the latest version.",
6897
)
6998
@click.argument("tool")
7099
def tool_upgrade(
71100
config: Config, verbose: int, tool: str, version: Optional[str], github_token: str
72101
):
102+
"""Upgrade (or downgrade) one of the required tools in `$XDG_CACHE_DIR/commodore/tools`.
103+
104+
The command will fail for tools which aren't managed by Commodore yet.
105+
106+
By default, the command will upgrade the tool to the latest available
107+
version. For `helm` and `kustomize`, the command downloads the official
108+
installation scripts and executes them with appropriate arguments. For `jb`,
109+
the command directly downloads the requested version from the GitHub release
110+
page.
111+
112+
Optionally, the command accepts a tool version to upgrade (or downgrade) to.
113+
The command accepts versions prefixed with "v" and unprefixed versions.
114+
"""
73115
config.update_verbosity(verbose)
74116
config.github_token = github_token
75117
tools.upgrade_tool(config, tool, version)

docs/modules/ROOT/pages/reference/cli.adoc

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,37 @@ However, labels added by previous runs can't be removed since we've got no easy
655655
The component template version (Git tree-ish) to use.
656656
If not provided, the currently active template version will be used.
657657

658+
== Tool List
659+
660+
*--github-token* TEXT::
661+
The GitHub access token to use when interacting with the GitHub API.
662+
We recommend passing the token in environment variable `COMMODORE_GITHUB_TOKEN`.
663+
664+
665+
*--version-check / -V, --skip-version-check*::
666+
Whether to query the GitHub API to get latest versions.
667+
668+
== Tool Install
669+
670+
*--github-token* TEXT::
671+
The GitHub access token to use when interacting with the GitHub API.
672+
We recommend passing the token in environment variable `COMMODORE_GITHUB_TOKEN`.
673+
674+
*--version VERSION*::
675+
Specify a version to install for the requested tool.
676+
By default, the latest version is installed.
677+
678+
679+
== Tool Upgrade
680+
681+
*--github-token* TEXT::
682+
The GitHub access token to use when interacting with the GitHub API.
683+
We recommend passing the token in environment variable `COMMODORE_GITHUB_TOKEN`.
684+
685+
*--version VERSION*::
686+
Specify a custom version to upgrade (or downgrade) to for the requested tool.
687+
By default, tools are upgraded to the latest version.
688+
658689
== Version
659690

660691
Show extended version information for Commodore.

docs/modules/ROOT/pages/reference/commands.adoc

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,47 @@ The command bases each PR on the default branch of the corresponding package rep
278278
The command requires a GitHub Access token with the 'public_repo' permission, which is required to create PRs on public repositories.
279279
If you want to manage private repos, the access token may require additional permissions.
280280

281+
== Tool List
282+
283+
commodore tool list
284+
285+
This command lists the version, location and management state of the required external tools.
286+
287+
Currently, `helm`, jsonnet-bundler/`jb`, and `kustomize` are required external tools.
288+
By default, the command also queries the GitHub API to determine the latest available version of each tool and indicates whether an update is available.
289+
290+
Optionally, the command accepts a GitHub personal access token (PAT) to avoid running into the fairly strict unauthenticated GitHub rate limits.
291+
292+
== Tool Install
293+
294+
commodore tool install TOOL
295+
296+
Install one of the required tools in `$XDG_CACHE_DIR/commodore/tools`.
297+
298+
The command will fail for tools which are already managed by Commodore.
299+
300+
By default, the command will install the latest available tool version.
301+
For `helm` and `kustomize`, the command downloads the official installation scripts and executes them with appropriate arguments.
302+
For `jb`, the command directly downloads the requested version from the GitHub release page.
303+
304+
Optionally, the command accepts a tool version to install.
305+
The command accepts versions prefixed with "v" and unprefixed versions.
306+
307+
== Tool Upgrade
308+
309+
commodore tool upgrade TOOL
310+
311+
Upgrade (or downgrade) one of the required tools in `$XDG_CACHE_DIR/commodore/tools`.
312+
313+
The command will fail for tools which aren't managed by Commodore yet.
314+
315+
By default, the command will upgrade the tool to the latest available version.
316+
For `helm` and `kustomize`, the command downloads the official installation scripts and executes them with appropriate arguments.
317+
For `jb`, the command directly downloads the requested version from the GitHub release page.
318+
319+
Optionally, the command accepts a tool version to upgrade (or downgrade) to.
320+
The command accepts versions prefixed with "v" and unprefixed versions.
321+
281322
== Version
282323

283324
commodore version

0 commit comments

Comments
 (0)