Fix buildQuery test calls to include inverseMatch argument

This commit is contained in:
2026-03-25 15:07:27 +11:00
parent e18fa8e4f3
commit 547333ecd2
3 changed files with 37 additions and 31 deletions
+3 -2
View File
@@ -29,7 +29,7 @@ Requires Go 1.21+. Dependencies: `github.com/spf13/cobra` (CLI), `gopkg.in/yaml.
./node-lookup -n <hostname> # lookup a specific node
./node-lookup -F <fact_name> # filter by fact name
./node-lookup -m <value> # exact value match
./node-lookup --pm <pattern> # partial/regex match on value
./node-lookup -p <pattern> # partial/regex match on value (also --pm)
./node-lookup -R -1 # node names only
./node-lookup -R -2 # values only
./node-lookup -R -C # count occurrences
@@ -94,6 +94,7 @@ No test suite exists. Manual testing requires access to the Consul/PuppetDB envi
## Gotchas
- `-1`, `-2`, `-C`, and `-A` all require `-R` or `-F`; the tool exits with an error otherwise.
- `-C` (count) with stdin reads all lines as pre-fetched `"node value"` output for counting — it does **not** query PuppetDB per line.
- `-C` (count) with stdin extracts the first field of each line as the node name, queries PuppetDB per node, then counts the resulting values.
- JSON output (`-j`) builds `{ hostname: { factname: value } }` where the fact key is the `-F` value, the `role_fact` config value (if `-R`), or `"value"` as fallback.
- `config init` fails if the config file already exists (will not overwrite).
- `--pm` has shorthand `-p`. Use `-p <pattern>` or `--pm <pattern>` — not `-pm <pattern>` (pflag parses single-dash multi-char as combined shorthands).