Skip to content

Commit 15fc822

Browse files
committed
fix(manifest): include lazily-registered --help and --version flags
Cobra registers the default help and version flags during Execute, so a command-tree walk performed before then omitted them. `vulnetix --version` was therefore absent from docs/command-manifest.json, and the documentation sites that validate their snippets against the manifest could not verify the flag the install guides tell users to run. Call InitDefaultHelpFlag/InitDefaultVersionFlag before walking, and document the real global flag set (--verbose, --silent, --no-progress, --no-banner, --no-analytics, --disable-memory, --version) in the CLI reference, with an explicit note that --verbose is a diagnostic toggle and not a log level: the CLI has no --debug flag and reads no DEBUG environment variable.
1 parent 1d06781 commit 15fc822

3 files changed

Lines changed: 25 additions & 5 deletions

File tree

cmd/manifest.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ var manifestCmd = &cobra.Command{
4949
// path with its flags. Persistent flags are attributed to the command that
5050
// declares them and to every descendant, because that is how a user sees them.
5151
func BuildCommandManifest() CommandManifest {
52+
// Cobra registers --help and --version lazily during Execute, so a walk
53+
// done before then would omit them from the manifest.
54+
rootCmd.InitDefaultHelpFlag()
55+
rootCmd.InitDefaultVersionFlag()
56+
5257
m := CommandManifest{Commands: map[string]ManifestCommand{}}
5358
walkCommand(rootCmd, nil, &m)
5459
return m

docs/command-manifest.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4814,12 +4814,14 @@
48144814
"short": "Vulnetix CLI - Automate vulnerability remediation",
48154815
"flags": [
48164816
"disable-memory",
4817+
"help",
48174818
"no-analytics",
48184819
"no-banner",
48194820
"no-progress",
48204821
"org-id",
48214822
"silent",
4822-
"verbose"
4823+
"verbose",
4824+
"version"
48234825
],
48244826
"subcommands": [
48254827
"aibom",

website/content/docs/cli-reference/_index.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -899,10 +899,23 @@ Flags apply to the `auth login` command that *writes* a credential; they are not
899899

900900
These flags are available on the root command and inherited by subcommands:
901901

902-
| Flag | Type | Required | Default | Description |
903-
|------|------|----------|---------|-------------|
904-
| `--org-id` | string | No | stored | Organization ID (UUID); uses stored credentials if not set |
905-
| `--help` | - | No | - | Help for any command |
902+
| Flag | Type | Default | Description |
903+
|------|------|---------|-------------|
904+
| `--org-id` | string | stored | Organization ID (UUID); uses stored credentials if not set |
905+
| `-v, --verbose` | bool | `false` | Show verbose diagnostic output (rate limits, retries, cache status, auth notes) |
906+
| `--silent` | bool | `false` | Suppress all log output; print only the final result |
907+
| `--no-progress` | bool | `false` | Suppress progress indicators |
908+
| `--no-banner` | bool | `false` | Suppress the startup banner |
909+
| `--no-analytics` | bool | `false` | Disable anonymous usage analytics |
910+
| `--disable-memory` | bool | `false` | Disable `.vulnetix/memory.yaml` reads and writes |
911+
| `--version` | - | - | Print the version and exit |
912+
| `--help` | - | - | Help for any command |
913+
914+
{{< callout type="info" >}}
915+
`--verbose` is **not** a log level — the CLI has no `--debug` flag and reads no `DEBUG` environment variable. It un-suppresses extra diagnostics on stderr. `--silent` suppresses info, status and warning output; errors and results are always printed.
916+
{{< /callout >}}
917+
918+
`vulnetix --version` prints the bare version. `vulnetix version` prints the full report (commit, build date, and the versions of the bundled `malscan-engine`, `vdb-cyclonedx` and OPA modules).
906919

907920
## Environment Variables
908921

0 commit comments

Comments
 (0)