Skip to content

Commit 545b49a

Browse files
committed
Add documentation for commodore tool command group
1 parent ad11657 commit 545b49a

3 files changed

Lines changed: 111 additions & 2 deletions

File tree

commodore/cli/tool.py

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ def tool_group(config: Config, verbose: int, github_token: str):
3232
help="Query GitHub API to get latest version",
3333
)
3434
def tool_list(config: Config, verbose: int, github_token: str, version_check: bool):
35+
"""List the version, location and management state of the required external tools.
36+
37+
Currently, `helm`, jsonnet-bundler/`jb`, and `kustomize` are required
38+
external tools. By default, the command also queries the GitHub API to
39+
determine the latest available version of each tool and indicates whether an
40+
update is available.
41+
42+
Optionally, the command accepts a GitHub personal access token (PAT) to
43+
avoid running into the fairly strict unauthenticated GitHub rate limits.
44+
"""
3545
config.update_verbosity(verbose)
3646
config.github_token = github_token
3747
tools.list_tools(config, version_check)
@@ -45,12 +55,25 @@ def tool_list(config: Config, verbose: int, github_token: str, version_check: bo
4555
"--version",
4656
default=None,
4757
metavar="VERSION",
48-
help="A custom version to install for the requested tool (by default the latest version is installed)",
58+
help="A version to install for the requested tool. "
59+
+ "By default, the latest version is installed.",
4960
)
5061
@click.argument("tool")
5162
def tool_install(
5263
config: Config, verbose: int, tool: str, version: Optional[str], github_token: str
5364
):
65+
"""Install one of the required tools in `$XDG_CACHE_DIR/commodore/tools`.
66+
67+
The command will fail for tools which are already managed by Commodore.
68+
69+
By default, the command will install the latest available tool version. For
70+
`helm` and `kustomize`, the command downloads the official installation
71+
scripts and executes them with appropriate arguments. For `jb`, the command
72+
directly downloads the requested version from the GitHub release page.
73+
74+
Optionally, the command accepts a tool version to install. The command
75+
accepts versions prefixed with "v" and unprefixed versions.
76+
"""
5477
config.update_verbosity(verbose)
5578
config.github_token = github_token
5679
tools.install_tool(config, tool, version)
@@ -64,12 +87,26 @@ def tool_install(
6487
"--version",
6588
default=None,
6689
metavar="VERSION",
67-
help="A custom version to install for the requested tool (by default the latest version is installed)",
90+
help="A version to upgrade (or downgrade) to for the requested tool. "
91+
+ "By default, the tool is upgraded to the latest version.",
6892
)
6993
@click.argument("tool")
7094
def tool_upgrade(
7195
config: Config, verbose: int, tool: str, version: Optional[str], github_token: str
7296
):
97+
"""Upgrade (or downgrade) one of the required tools in `$XDG_CACHE_DIR/commodore/tools`.
98+
99+
The command will fail for tools which aren't managed by Commodore yet.
100+
101+
By default, the command will upgrade the tool to the latest available
102+
version. For `helm` and `kustomize`, the command downloads the official
103+
installation scripts and executes them with appropriate arguments. For `jb`,
104+
the command directly downloads the requested version from the GitHub release
105+
page.
106+
107+
Optionally, the command accepts a tool version to upgrade (or downgrade) to.
108+
The command accepts versions prefixed with "v" and unprefixed versions.
109+
"""
73110
config.update_verbosity(verbose)
74111
config.github_token = github_token
75112
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)