mirror of
https://github.com/gravitational/teleport.git
synced 2026-09-19 11:00:37 +08:00
This commit enhances the CLI reference documentation by automatically displaying valid enum values in the "Default" column of flag tables, eliminating the need to manually list these values in flag descriptions. It also adds a CI step to verify that CLI reference docs stay in sync with source code changes. The core implementation uses reflection to extract enum values from kingpin flags and formats them as "(valid: `value1`, `value2`, ...)". All CLI source files have been updated to remove duplicate enum value lists from flag help text, as these are now automatically rendered. A new 'cli-docs-up-to-date' Makefile target and corresponding GitHub Actions workflow job ensure that any changes to CLI flags are reflected in the generated documentation. Example output: Before: |`--format`|`yaml`|Output format, 'yaml', 'json', or 'text'| After: |`--format`|`yaml` (valid: `yaml`, `json`, `text`)|Output format.| Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
31 lines
1.0 KiB
Go
31 lines
1.0 KiB
Go
// Teleport
|
|
// Copyright (C) 2025 Gravitational, Inc.
|
|
//
|
|
// This program is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU Affero General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// This program is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU Affero General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
//go:build !docs
|
|
|
|
package utils
|
|
|
|
import (
|
|
"github.com/alecthomas/kingpin/v2"
|
|
)
|
|
|
|
// UpdateAppUsageTemplate is a no-op for regular builds. See usage_docs.go for
|
|
// doc generation.
|
|
func UpdateAppUsageTemplate(*kingpin.Application) {}
|
|
|
|
// DocsMode is false in regular builds. It is true when building with -tags docs.
|
|
const DocsMode = false
|