Skip to content

Commit 1b31daa

Browse files
Mark hidden commands in build-cli-definition tool (#847)
~~Make the `build-cli-definition` tool not include hidden commands in the generated CLI definition JSON file.~~ ~~Hidden commands are either internal (like `anaylze`) or work in progress (like `baseline`) and shouldn't be included in the generated CLI definition.~~ Updated based on #847 (review). Make the `build-cli-definition` tool mark hidden commands in the generated JSON output.
1 parent 529d721 commit 1b31daa

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

cli-definition.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"name": "analyze",
66
"short": "Analyze the SQL schema of the target database",
77
"use": "analyze",
8+
"hidden": true,
89
"example": "",
910
"flags": [],
1011
"subcommands": [],
@@ -14,6 +15,7 @@
1415
"name": "baseline",
1516
"short": "Create a baseline migration for an existing database schema",
1617
"use": "baseline <version> <target directory>",
18+
"hidden": true,
1719
"example": "",
1820
"flags": [
1921
{

tools/build-cli-definition.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ type Command struct {
2323
Name string `json:"name"`
2424
Short string `json:"short"`
2525
Use string `json:"use"`
26+
Hidden bool `json:"hidden,omitempty"`
2627
Example string `json:"example"`
2728
Flags []Flag `json:"flags"`
2829
Subcommands []Command `json:"subcommands"`
@@ -71,6 +72,7 @@ func processCommand(cmd *cobra.Command) Command {
7172
Name: cmd.Name(),
7273
Short: cmd.Short,
7374
Use: cmd.Use,
75+
Hidden: cmd.Hidden,
7476
Example: cmd.Example,
7577
Args: validateArgs(cmd),
7678
Flags: extractFlags(cmd.Flags()),

0 commit comments

Comments
 (0)