From ed2e6dffdf3c8a08ac9b81b900ee8500102f8ec8 Mon Sep 17 00:00:00 2001 From: Konstantin Sykulev Date: Mon, 9 Dec 2024 12:47:52 -0600 Subject: [PATCH] Better documentation in fleetctl query command for label flag (#24556) # Checklist for submitter https://github.com/fleetdm/fleet/issues/23880 - [X] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. See [Changes files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/Committing-Changes.md#changes-files) for more information. --- changes/23880-fleet-ctl-label-docs | 1 + cmd/fleetctl/query.go | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 changes/23880-fleet-ctl-label-docs diff --git a/changes/23880-fleet-ctl-label-docs b/changes/23880-fleet-ctl-label-docs new file mode 100644 index 0000000000..870b424a05 --- /dev/null +++ b/changes/23880-fleet-ctl-label-docs @@ -0,0 +1 @@ +* Added better documentation around how the --label flag works in the fleetctl query command. \ No newline at end of file diff --git a/cmd/fleetctl/query.go b/cmd/fleetctl/query.go index e54fbee2bc..6866a5a5c1 100644 --- a/cmd/fleetctl/query.go +++ b/cmd/fleetctl/query.go @@ -24,6 +24,12 @@ func queryCommand() *cli.Command { Name: "query", Usage: "Run a live query", UsageText: `fleetctl query [options]`, + Description: `Runs the specified query as a live query on the specified targets. + +Using the --hosts flag individual hosts can be specified with the host's hostname. Groups of hosts can +specified by using labels. Note if both the --hosts and --labels flags are specified, the query will +be run on the union of the hosts and hosts with matching labels. + `, Flags: []cli.Flag{ &cli.StringFlag{ Name: "hosts", @@ -37,7 +43,7 @@ func queryCommand() *cli.Command { EnvVars: []string{"LABELS"}, Value: "", Destination: &flLabels, - Usage: "Comma-separated label names to target", + Usage: "Comma-separated label names to target. Hosts with any of the labels will be targeted.", }, &cli.BoolFlag{ Name: "quiet",