Add fmt-gen subcommand (#20192)

fmt-gen subcommand is only available when built with build tag `fmtgen`.
This commit is contained in:
Krishnan Parthasarathi
2024-07-30 15:59:48 -07:00
committed by GitHub
parent 4c8562bcec
commit 01a8c09920
3 changed files with 150 additions and 0 deletions

View File

@@ -107,6 +107,11 @@ func newApp(name string) *cli.App {
// registerCommand registers a cli command.
registerCommand := func(command cli.Command) {
// avoid registering commands which are not being built (via
// go:build tags)
if command.Name == "" {
return
}
commands = append(commands, command)
commandsTree.Insert(command.Name)
}
@@ -134,6 +139,7 @@ func newApp(name string) *cli.App {
// Register all commands.
registerCommand(serverCmd)
registerCommand(fmtGenCmd)
// Set up app.
cli.HelpFlag = cli.BoolFlag{