Skip to content

Commit d5be50a

Browse files
committed
docs: split talosctl commands into groups
Use the grouping feature to reflect internal command structure better in the `--help` output. ``` $ talosctl --help A CLI for out-of-band management of Kubernetes nodes created by Talos Usage: talosctl [command] Manage running Talos clusters: apply-config Apply a new configuration to a node bootstrap Bootstrap the etcd cluster on the specified node. cgroups Retrieve cgroups usage information config Manage the client configuration file (talosconfig) conformance Run conformance tests containers List containers copy Copy data out from the node dashboard Cluster dashboard with node overview, logs and real-time metrics dmesg Retrieve kernel logs edit Edit Talos node machine configuration with the default editor. etcd Manage etcd events Stream runtime events get Get a specific resource or list of resources (use 'talosctl get rd' to see all available resource types). health Check cluster health image Manage CRI container images inspect Inspect internals of Talos kubeconfig Download the admin kubeconfig from the node list Retrieve a directory listing logs Retrieve logs for a service memory Show memory usage meta Write and delete keys in the META partition mounts List mounts netstat Show network connections and sockets patch Patch machine configuration of a Talos node with a local patch. pcap Capture the network packets from the node. processes List running processes read Read a file on the machine reboot Reboot a node reset Reset a node restart Restart a process rollback Rollback a node to the previous installation rotate-ca Rotate cluster CAs (Talos and Kubernetes APIs). service Retrieve the state of a service (or all services), control service state shutdown Shutdown a node stats Get container stats support Dump debug information about the cluster time Gets current server time upgrade Upgrade Talos on the target node upgrade-k8s Upgrade Kubernetes control plane in the Talos cluster. usage Retrieve a disk usage version Prints the version wipe Wipe block device or volumes Commands to generate and manage machine configuration offline: gen Generate CAs, certificates, and private keys inject Inject Talos API resources into Kubernetes manifests machineconfig Machine config related commands validate Validate config Local Talos cluster commands: cluster A collection of commands for managing local docker-based or QEMU-based clusters Additional Commands: completion Output shell completion code for the specified shell (bash, fish or zsh) help Help about any command Flags: -h, --help help for talosctl Use "talosctl [command] --help" for more information about a command. ``` Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com> (cherry picked from commit 43b43ff)
1 parent 70d3ab9 commit d5be50a

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

cmd/talosctl/cmd/root.go

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ import (
88
"context"
99
"fmt"
1010
"os"
11-
"slices"
1211
"strings"
1312

1413
"github.com/spf13/cobra"
1514

1615
"github.com/siderolabs/talos/cmd/talosctl/cmd/common"
1716
"github.com/siderolabs/talos/cmd/talosctl/cmd/mgmt"
17+
"github.com/siderolabs/talos/cmd/talosctl/cmd/mgmt/cluster"
1818
_ "github.com/siderolabs/talos/cmd/talosctl/cmd/mgmt/cluster/create" // import to get the command registered via the init() function.
1919
"github.com/siderolabs/talos/cmd/talosctl/cmd/talos"
2020
)
@@ -49,7 +49,27 @@ func Execute() error {
4949
}
5050

5151
func init() {
52-
for _, cmd := range slices.Concat(talos.Commands, mgmt.Commands) {
52+
const (
53+
talosGroup = "talos"
54+
mgmtGroup = "mgmt"
55+
clusterGroup = "cluster"
56+
)
57+
58+
rootCmd.AddGroup(&cobra.Group{ID: talosGroup, Title: "Manage running Talos clusters:"})
59+
rootCmd.AddGroup(&cobra.Group{ID: mgmtGroup, Title: "Commands to generate and manage machine configuration offline:"})
60+
rootCmd.AddGroup(&cobra.Group{ID: clusterGroup, Title: "Local Talos cluster commands:"})
61+
62+
for _, cmd := range mgmt.Commands {
63+
cmd.GroupID = mgmtGroup
64+
if cmd == cluster.Cmd {
65+
cmd.GroupID = clusterGroup
66+
}
67+
68+
rootCmd.AddCommand(cmd)
69+
}
70+
71+
for _, cmd := range talos.Commands {
72+
cmd.GroupID = talosGroup
5373
rootCmd.AddCommand(cmd)
5474
}
5575
}

0 commit comments

Comments
 (0)