From e5032508e94b2ec3a1bc538c0c4289e1ca882a3c Mon Sep 17 00:00:00 2001 From: David Crespo Date: Wed, 3 Jul 2024 11:16:19 -0500 Subject: [PATCH] add required field to generated CLI schema --- cli/docs/cli.json | 522 +++++++++++++++++++++++++++++--------------- cli/src/cmd_docs.rs | 8 + 2 files changed, 356 insertions(+), 174 deletions(-) diff --git a/cli/docs/cli.json b/cli/docs/cli.json index 6a15b3b8..4572f881 100644 --- a/cli/docs/cli.json +++ b/cli/docs/cli.json @@ -89,7 +89,8 @@ { "long": "host", "short": "H", - "help": "The host of the Oxide instance to authenticate with. This assumes http; specify an `http://` prefix if needed" + "help": "The host of the Oxide instance to authenticate with. This assumes http; specify an `http://` prefix if needed", + "required": true }, { "long": "no-browser", @@ -187,7 +188,8 @@ "long_about": "Permanently delete a certificate. This operation cannot be undone.", "args": [ { - "long": "certificate" + "long": "certificate", + "required": true } ] }, @@ -216,7 +218,8 @@ "long_about": "Returns the details of a specific certificate", "args": [ { - "long": "certificate" + "long": "certificate", + "required": true } ] } @@ -237,7 +240,8 @@ "powershell", "zsh" ], - "help": "Shell type" + "help": "Shell type", + "required": true } ] }, @@ -295,7 +299,8 @@ "args": [ { "long": "ssh-key", - "help": "Name or ID of the SSH key" + "help": "Name or ID of the SSH key", + "required": true } ] }, @@ -325,7 +330,8 @@ "args": [ { "long": "ssh-key", - "help": "Name or ID of the SSH key" + "help": "Name or ID of the SSH key", + "required": true } ] } @@ -349,7 +355,8 @@ }, { "long": "json-body", - "help": "Path to a file that contains the full json body." + "help": "Path to a file that contains the full json body.", + "required": true }, { "long": "json-body-template", @@ -360,7 +367,8 @@ }, { "long": "project", - "help": "Name or ID of the project" + "help": "Name or ID of the project", + "required": true }, { "long": "size", @@ -374,7 +382,8 @@ "args": [ { "long": "disk", - "help": "Name or ID of the disk" + "help": "Name or ID of the disk", + "required": true }, { "long": "project", @@ -388,11 +397,13 @@ "long_about": "Create a disk from a file upload\n\nCreate a new disk and upload the contents of a file to that disk. Use\n`--snapshot` to optionally create a snapshot of the disk after the upload is\ncomplete. If creating a snapshot, optionally use the `--image` options to\ncreate an image from that snapshot.\n\nThe start, write, stop, and finalize subcommands can be used for lower-\nlevel operations.", "args": [ { - "long": "description" + "long": "description", + "required": true }, { "long": "disk", - "help": "The name of the disk to create" + "help": "The name of the disk to create", + "required": true }, { "long": "disk-block-size", @@ -425,11 +436,13 @@ }, { "long": "path", - "help": "Path to the file to import" + "help": "Path to the file to import", + "required": true }, { "long": "project", - "help": "Name or ID of the project" + "help": "Name or ID of the project", + "required": true }, { "long": "snapshot", @@ -443,7 +456,8 @@ "args": [ { "long": "disk", - "help": "Name or ID of the disk" + "help": "Name or ID of the disk", + "required": true }, { "long": "json-body", @@ -470,7 +484,8 @@ "args": [ { "long": "disk", - "help": "Name or ID of the disk" + "help": "Name or ID of the disk", + "required": true }, { "long": "project", @@ -485,7 +500,8 @@ "args": [ { "long": "disk", - "help": "Name or ID of the disk" + "help": "Name or ID of the disk", + "required": true }, { "long": "project", @@ -502,7 +518,8 @@ }, { "long": "disk", - "help": "Name or ID of the disk" + "help": "Name or ID of the disk", + "required": true }, { "long": "json-body", @@ -533,7 +550,8 @@ }, { "long": "project", - "help": "Name or ID of the project" + "help": "Name or ID of the project", + "required": true }, { "long": "sort-by", @@ -553,11 +571,13 @@ "about": "Fetch disk metrics", "args": [ { - "long": "disk" + "long": "disk", + "required": true }, { "long": "end-time", - "help": "An exclusive end time of metrics." + "help": "An exclusive end time of metrics.", + "required": true }, { "long": "limit", @@ -572,7 +592,8 @@ "read_bytes", "write", "write_bytes" - ] + ], + "required": true }, { "long": "order", @@ -588,7 +609,8 @@ }, { "long": "start-time", - "help": "An inclusive start time of metrics." + "help": "An inclusive start time of metrics.", + "required": true } ] } @@ -600,7 +622,8 @@ "args": [ { "long": "disk", - "help": "Name or ID of the disk" + "help": "Name or ID of the disk", + "required": true }, { "long": "project", @@ -643,7 +666,8 @@ }, { "long": "project", - "help": "Name or ID of the project" + "help": "Name or ID of the project", + "required": true }, { "long": "sled" @@ -656,11 +680,13 @@ "args": [ { "long": "probe", - "help": "Name or ID of the probe" + "help": "Name or ID of the probe", + "required": true }, { "long": "project", - "help": "Name or ID of the project" + "help": "Name or ID of the project", + "required": true } ] }, @@ -674,7 +700,8 @@ }, { "long": "project", - "help": "Name or ID of the project" + "help": "Name or ID of the project", + "required": true }, { "long": "sort-by", @@ -692,11 +719,13 @@ "args": [ { "long": "probe", - "help": "Name or ID of the probe" + "help": "Name or ID of the probe", + "required": true }, { "long": "project", - "help": "Name or ID of the project" + "help": "Name or ID of the project", + "required": true } ] } @@ -764,7 +793,8 @@ "args": [ { "long": "floating-ip", - "help": "Name or ID of the floating IP" + "help": "Name or ID of the floating IP", + "required": true }, { "long": "json-body", @@ -819,7 +849,8 @@ }, { "long": "project", - "help": "Name or ID of the project" + "help": "Name or ID of the project", + "required": true } ] }, @@ -829,7 +860,8 @@ "args": [ { "long": "floating-ip", - "help": "Name or ID of the floating IP" + "help": "Name or ID of the floating IP", + "required": true }, { "long": "project", @@ -843,7 +875,8 @@ "args": [ { "long": "floating-ip", - "help": "Name or ID of the floating IP" + "help": "Name or ID of the floating IP", + "required": true }, { "long": "project", @@ -861,7 +894,8 @@ }, { "long": "project", - "help": "Name or ID of the project" + "help": "Name or ID of the project", + "required": true }, { "long": "sort-by", @@ -882,7 +916,8 @@ }, { "long": "floating-ip", - "help": "Name or ID of the floating IP" + "help": "Name or ID of the floating IP", + "required": true }, { "long": "json-body", @@ -907,7 +942,8 @@ "args": [ { "long": "floating-ip", - "help": "Name or ID of the floating IP" + "help": "Name or ID of the floating IP", + "required": true }, { "long": "project", @@ -951,7 +987,8 @@ }, { "long": "json-body", - "help": "Path to a file that contains the full json body." + "help": "Path to a file that contains the full json body.", + "required": true }, { "long": "json-body-template", @@ -981,7 +1018,8 @@ "args": [ { "long": "image", - "help": "Name or ID of the image" + "help": "Name or ID of the image", + "required": true }, { "long": "project", @@ -996,11 +1034,13 @@ "args": [ { "long": "image", - "help": "Name or ID of the image" + "help": "Name or ID of the image", + "required": true }, { "long": "project", - "help": "Name or ID of the project" + "help": "Name or ID of the project", + "required": true } ] }, @@ -1034,7 +1074,8 @@ "args": [ { "long": "image", - "help": "Name or ID of the image" + "help": "Name or ID of the image", + "required": true }, { "long": "project", @@ -1049,7 +1090,8 @@ "args": [ { "long": "image", - "help": "Name or ID of the image" + "help": "Name or ID of the image", + "required": true }, { "long": "project", @@ -1091,7 +1133,8 @@ }, { "long": "project", - "help": "Name or ID of the project" + "help": "Name or ID of the project", + "required": true }, { "long": "start", @@ -1113,7 +1156,8 @@ "args": [ { "long": "instance", - "help": "Name or ID of the instance" + "help": "Name or ID of the instance", + "required": true }, { "long": "project", @@ -1134,7 +1178,8 @@ }, { "long": "instance", - "help": "Name or ID of the instance" + "help": "Name or ID of the instance", + "required": true }, { "long": "json-body", @@ -1160,7 +1205,8 @@ }, { "long": "instance", - "help": "Name or ID of the instance" + "help": "Name or ID of the instance", + "required": true }, { "long": "json-body", @@ -1182,7 +1228,8 @@ "args": [ { "long": "instance", - "help": "Name or ID of the instance" + "help": "Name or ID of the instance", + "required": true }, { "long": "limit", @@ -1213,7 +1260,8 @@ "args": [ { "long": "instance", - "help": "Name or ID of the instance" + "help": "Name or ID of the instance", + "required": true }, { "long": "json-body", @@ -1239,7 +1287,8 @@ "args": [ { "long": "instance", - "help": "Name or ID of the instance" + "help": "Name or ID of the instance", + "required": true }, { "long": "project", @@ -1253,7 +1302,8 @@ "args": [ { "long": "instance", - "help": "Name or ID of the instance" + "help": "Name or ID of the instance", + "required": true }, { "long": "project", @@ -1269,35 +1319,43 @@ "args": [ { "long": "description", - "help": "Description of the instance to create" + "help": "Description of the instance to create", + "required": true }, { "long": "hostname", - "help": "Hostname of the instance to create" + "help": "Hostname of the instance to create", + "required": true }, { "long": "image", - "help": "Source image" + "help": "Source image", + "required": true }, { "long": "memory", - "help": "Instance memory e.g 32M. Suffix can be k,m,g,t" + "help": "Instance memory e.g 32M. Suffix can be k,m,g,t", + "required": true }, { "long": "name", - "help": "Name of the instance to create" + "help": "Name of the instance to create", + "required": true }, { "long": "ncpus", - "help": "Instance CPU count" + "help": "Instance CPU count", + "required": true }, { "long": "project", - "help": "Project for image and instance" + "help": "Project for image and instance", + "required": true }, { "long": "size", - "help": "Boot disk size e.g. 512G. Suffix can be k,m,g,t" + "help": "Boot disk size e.g. 512G. Suffix can be k,m,g,t", + "required": true }, { "long": "start", @@ -1315,7 +1373,8 @@ }, { "long": "project", - "help": "Name or ID of the project" + "help": "Name or ID of the project", + "required": true }, { "long": "sort-by", @@ -1339,7 +1398,8 @@ }, { "long": "instance", - "help": "Name or ID of the instance" + "help": "Name or ID of the instance", + "required": true }, { "long": "ip", @@ -1381,7 +1441,8 @@ }, { "long": "interface", - "help": "Name or ID of the network interface" + "help": "Name or ID of the network interface", + "required": true }, { "long": "project", @@ -1395,7 +1456,8 @@ "args": [ { "long": "instance", - "help": "Name or ID of the instance" + "help": "Name or ID of the instance", + "required": true }, { "long": "limit", @@ -1428,7 +1490,8 @@ }, { "long": "interface", - "help": "Name or ID of the network interface" + "help": "Name or ID of the network interface", + "required": true }, { "long": "json-body", @@ -1465,7 +1528,8 @@ }, { "long": "interface", - "help": "Name or ID of the network interface" + "help": "Name or ID of the network interface", + "required": true }, { "long": "project", @@ -1481,7 +1545,8 @@ "args": [ { "long": "instance", - "help": "Name or ID of the instance" + "help": "Name or ID of the instance", + "required": true }, { "long": "project", @@ -1510,7 +1575,8 @@ { "long": "instance", "short": "i", - "help": "Name or ID of the instance" + "help": "Name or ID of the instance", + "required": true }, { "long": "most-recent", @@ -1542,7 +1608,8 @@ { "long": "instance", "short": "i", - "help": "Name or ID of the instance" + "help": "Name or ID of the instance", + "required": true }, { "long": "json", @@ -1573,7 +1640,8 @@ "args": [ { "long": "instance", - "help": "Name or ID of the instance" + "help": "Name or ID of the instance", + "required": true }, { "long": "limit", @@ -1601,7 +1669,8 @@ "args": [ { "long": "instance", - "help": "Name or ID of the instance" + "help": "Name or ID of the instance", + "required": true }, { "long": "project", @@ -1615,7 +1684,8 @@ "args": [ { "long": "instance", - "help": "Name or ID of the instance" + "help": "Name or ID of the instance", + "required": true }, { "long": "project", @@ -1629,7 +1699,8 @@ "args": [ { "long": "instance", - "help": "Name or ID of the instance" + "help": "Name or ID of the instance", + "required": true }, { "long": "project", @@ -1668,7 +1739,8 @@ "args": [ { "long": "pool", - "help": "Name or ID of the IP pool" + "help": "Name or ID of the IP pool", + "required": true } ] }, @@ -1699,7 +1771,8 @@ "long_about": "IPv6 ranges are not allowed yet.", "args": [ { - "long": "first" + "long": "first", + "required": true }, { "long": "json-body", @@ -1710,11 +1783,13 @@ "help": "XXX" }, { - "long": "last" + "long": "last", + "required": true }, { "long": "pool", - "help": "Name or ID of the IP pool" + "help": "Name or ID of the IP pool", + "required": true } ] }, @@ -1729,7 +1804,8 @@ }, { "long": "pool", - "help": "Name or ID of the IP pool" + "help": "Name or ID of the IP pool", + "required": true } ] }, @@ -1738,7 +1814,8 @@ "about": "Remove range from IP pool", "args": [ { - "long": "first" + "long": "first", + "required": true }, { "long": "json-body", @@ -1749,11 +1826,13 @@ "help": "XXX" }, { - "long": "last" + "long": "last", + "required": true }, { "long": "pool", - "help": "Name or ID of the IP pool" + "help": "Name or ID of the IP pool", + "required": true } ] } @@ -1771,7 +1850,8 @@ "long_about": "IPv6 ranges are not allowed yet.", "args": [ { - "long": "first" + "long": "first", + "required": true }, { "long": "json-body", @@ -1782,7 +1862,8 @@ "help": "XXX" }, { - "long": "last" + "long": "last", + "required": true } ] }, @@ -1804,7 +1885,8 @@ "about": "Remove IP range from Oxide service pool", "args": [ { - "long": "first" + "long": "first", + "required": true }, { "long": "json-body", @@ -1815,7 +1897,8 @@ "help": "XXX" }, { - "long": "last" + "long": "last", + "required": true } ] }, @@ -1851,7 +1934,8 @@ }, { "long": "pool", - "help": "Name or ID of the IP pool" + "help": "Name or ID of the IP pool", + "required": true }, { "long": "silo" @@ -1868,7 +1952,8 @@ }, { "long": "pool", - "help": "Name or ID of the IP pool" + "help": "Name or ID of the IP pool", + "required": true }, { "long": "sort-by", @@ -1884,10 +1969,12 @@ "long_about": "Will fail if there are any outstanding IPs allocated in the silo.", "args": [ { - "long": "pool" + "long": "pool", + "required": true }, { - "long": "silo" + "long": "silo", + "required": true } ] }, @@ -1913,10 +2000,12 @@ "help": "XXX" }, { - "long": "pool" + "long": "pool", + "required": true }, { - "long": "silo" + "long": "silo", + "required": true } ] } @@ -1942,7 +2031,8 @@ }, { "long": "pool", - "help": "Name or ID of the IP pool" + "help": "Name or ID of the IP pool", + "required": true } ] }, @@ -1952,7 +2042,8 @@ "args": [ { "long": "pool", - "help": "Name or ID of the IP pool" + "help": "Name or ID of the IP pool", + "required": true } ] }, @@ -1962,7 +2053,8 @@ "args": [ { "long": "pool", - "help": "Name or ID of the IP pool" + "help": "Name or ID of the IP pool", + "required": true } ] } @@ -1982,7 +2074,8 @@ "args": [ { "long": "json-body", - "help": "Path to a file that contains the full json body." + "help": "Path to a file that contains the full json body.", + "required": true }, { "long": "json-body-template", @@ -2025,7 +2118,8 @@ "args": [ { "long": "project", - "help": "Name or ID of the project" + "help": "Name or ID of the project", + "required": true } ] }, @@ -2056,7 +2150,8 @@ "args": [ { "long": "pool", - "help": "Name or ID of the IP pool" + "help": "Name or ID of the IP pool", + "required": true } ] } @@ -2089,7 +2184,8 @@ "args": [ { "long": "json-body", - "help": "Path to a file that contains the full json body." + "help": "Path to a file that contains the full json body.", + "required": true }, { "long": "json-body-template", @@ -2097,7 +2193,8 @@ }, { "long": "project", - "help": "Name or ID of the project" + "help": "Name or ID of the project", + "required": true } ] }, @@ -2107,7 +2204,8 @@ "args": [ { "long": "project", - "help": "Name or ID of the project" + "help": "Name or ID of the project", + "required": true } ] } @@ -2133,7 +2231,8 @@ }, { "long": "project", - "help": "Name or ID of the project" + "help": "Name or ID of the project", + "required": true } ] }, @@ -2143,7 +2242,8 @@ "args": [ { "long": "project", - "help": "Name or ID of the project" + "help": "Name or ID of the project", + "required": true } ] } @@ -2179,7 +2279,8 @@ }, { "long": "json-body", - "help": "Path to a file that contains the full json body." + "help": "Path to a file that contains the full json body.", + "required": true }, { "long": "json-body-template", @@ -2197,7 +2298,8 @@ "args": [ { "long": "silo", - "help": "Name or ID of the silo" + "help": "Name or ID of the silo", + "required": true } ] }, @@ -2214,7 +2316,8 @@ }, { "long": "silo", - "help": "Name or ID of the silo" + "help": "Name or ID of the silo", + "required": true }, { "long": "sort-by", @@ -2243,7 +2346,8 @@ }, { "long": "json-body", - "help": "Path to a file that contains the full json body." + "help": "Path to a file that contains the full json body.", + "required": true }, { "long": "json-body-template", @@ -2251,7 +2355,8 @@ }, { "long": "silo", - "help": "Name or ID of the silo" + "help": "Name or ID of the silo", + "required": true } ] }, @@ -2261,11 +2366,13 @@ "args": [ { "long": "silo", - "help": "Name or ID of the silo" + "help": "Name or ID of the silo", + "required": true }, { "long": "user-id", - "help": "The user's internal id" + "help": "The user's internal id", + "required": true } ] }, @@ -2276,7 +2383,8 @@ "args": [ { "long": "json-body", - "help": "Path to a file that contains the full json body." + "help": "Path to a file that contains the full json body.", + "required": true }, { "long": "json-body-template", @@ -2284,11 +2392,13 @@ }, { "long": "silo", - "help": "Name or ID of the silo" + "help": "Name or ID of the silo", + "required": true }, { "long": "user-id", - "help": "The user's internal id" + "help": "The user's internal id", + "required": true } ] } @@ -2337,7 +2447,8 @@ }, { "long": "silo", - "help": "Name or ID of the silo" + "help": "Name or ID of the silo", + "required": true }, { "long": "slo-url", @@ -2359,11 +2470,13 @@ "args": [ { "long": "provider", - "help": "Name or ID of the SAML identity provider" + "help": "Name or ID of the SAML identity provider", + "required": true }, { "long": "silo", - "help": "Name or ID of the silo" + "help": "Name or ID of the silo", + "required": true } ] } @@ -2385,7 +2498,8 @@ }, { "long": "silo", - "help": "Name or ID of the silo" + "help": "Name or ID of the silo", + "required": true }, { "long": "sort-by", @@ -2427,7 +2541,8 @@ "args": [ { "long": "json-body", - "help": "Path to a file that contains the full json body." + "help": "Path to a file that contains the full json body.", + "required": true }, { "long": "json-body-template", @@ -2435,7 +2550,8 @@ }, { "long": "silo", - "help": "Name or ID of the silo" + "help": "Name or ID of the silo", + "required": true } ] }, @@ -2445,7 +2561,8 @@ "args": [ { "long": "silo", - "help": "Name or ID of the silo" + "help": "Name or ID of the silo", + "required": true } ] } @@ -2493,7 +2610,8 @@ }, { "long": "silo", - "help": "Name or ID of the silo" + "help": "Name or ID of the silo", + "required": true }, { "long": "storage", @@ -2507,7 +2625,8 @@ "args": [ { "long": "silo", - "help": "Name or ID of the silo" + "help": "Name or ID of the silo", + "required": true } ] } @@ -2526,7 +2645,8 @@ }, { "long": "silo", - "help": "Name or ID of the silo" + "help": "Name or ID of the silo", + "required": true }, { "long": "sort-by", @@ -2542,11 +2662,13 @@ "args": [ { "long": "silo", - "help": "Name or ID of the silo" + "help": "Name or ID of the silo", + "required": true }, { "long": "user-id", - "help": "The user's internal id" + "help": "The user's internal id", + "required": true } ] } @@ -2579,7 +2701,8 @@ "args": [ { "long": "silo", - "help": "Name or ID of the silo" + "help": "Name or ID of the silo", + "required": true } ] } @@ -2592,7 +2715,8 @@ "args": [ { "long": "silo", - "help": "Name or ID of the silo" + "help": "Name or ID of the silo", + "required": true } ] } @@ -2626,7 +2750,8 @@ }, { "long": "project", - "help": "Name or ID of the project" + "help": "Name or ID of the project", + "required": true } ] }, @@ -2640,7 +2765,8 @@ }, { "long": "snapshot", - "help": "Name or ID of the snapshot" + "help": "Name or ID of the snapshot", + "required": true } ] }, @@ -2654,7 +2780,8 @@ }, { "long": "project", - "help": "Name or ID of the project" + "help": "Name or ID of the project", + "required": true }, { "long": "sort-by", @@ -2676,7 +2803,8 @@ }, { "long": "snapshot", - "help": "Name or ID of the snapshot" + "help": "Name or ID of the snapshot", + "required": true } ] } @@ -2713,7 +2841,8 @@ "args": [ { "long": "disk-id", - "help": "ID of the physical disk" + "help": "ID of the physical disk", + "required": true } ] } @@ -2744,7 +2873,8 @@ "args": [ { "long": "rack-id", - "help": "The rack's unique ID." + "help": "The rack's unique ID.", + "required": true } ] } @@ -2783,7 +2913,8 @@ }, { "long": "sled-id", - "help": "ID of the sled" + "help": "ID of the sled", + "required": true }, { "long": "sort-by", @@ -2803,7 +2934,8 @@ }, { "long": "sled-id", - "help": "ID of the sled" + "help": "ID of the sled", + "required": true }, { "long": "sort-by", @@ -2853,7 +2985,8 @@ }, { "long": "sled-id", - "help": "ID of the sled" + "help": "ID of the sled", + "required": true }, { "long": "state", @@ -2871,7 +3004,8 @@ "args": [ { "long": "sled-id", - "help": "ID of the sled" + "help": "ID of the sled", + "required": true } ] } @@ -2902,7 +3036,8 @@ "args": [ { "long": "switch-id", - "help": "ID of the switch" + "help": "ID of the switch", + "required": true } ] } @@ -2925,7 +3060,8 @@ }, { "long": "port", - "help": "A name to use when selecting switch ports." + "help": "A name to use when selecting switch ports.", + "required": true }, { "long": "port-settings", @@ -2933,11 +3069,13 @@ }, { "long": "rack-id", - "help": "A rack id to use when selecting switch ports." + "help": "A rack id to use when selecting switch ports.", + "required": true }, { "long": "switch-location", - "help": "A switch location to use when selecting switch ports." + "help": "A switch location to use when selecting switch ports.", + "required": true } ] }, @@ -2947,15 +3085,18 @@ "args": [ { "long": "port", - "help": "A name to use when selecting switch ports." + "help": "A name to use when selecting switch ports.", + "required": true }, { "long": "rack-id", - "help": "A rack id to use when selecting switch ports." + "help": "A rack id to use when selecting switch ports.", + "required": true }, { "long": "switch-location", - "help": "A switch location to use when selecting switch ports." + "help": "A switch location to use when selecting switch ports.", + "required": true } ] }, @@ -2985,15 +3126,18 @@ "args": [ { "long": "port", - "help": "A name to use when selecting switch ports." + "help": "A name to use when selecting switch ports.", + "required": true }, { "long": "rack-id", - "help": "A rack id to use when selecting switch ports." + "help": "A rack id to use when selecting switch ports.", + "required": true }, { "long": "switch-location", - "help": "A switch location to use when selecting switch ports." + "help": "A switch location to use when selecting switch ports.", + "required": true } ] } @@ -3016,7 +3160,8 @@ "args": [ { "long": "address-lot", - "help": "Name or ID of the address lot" + "help": "Name or ID of the address lot", + "required": true }, { "long": "limit", @@ -3041,7 +3186,8 @@ }, { "long": "json-body", - "help": "Path to a file that contains the full json body." + "help": "Path to a file that contains the full json body.", + "required": true }, { "long": "json-body-template", @@ -3066,7 +3212,8 @@ "args": [ { "long": "address-lot", - "help": "Name or ID of the address lot" + "help": "Name or ID of the address lot", + "required": true } ] }, @@ -3207,7 +3354,8 @@ }, { "long": "json-body", - "help": "Path to a file that contains the full json body." + "help": "Path to a file that contains the full json body.", + "required": true }, { "long": "json-body-template", @@ -3224,7 +3372,8 @@ "args": [ { "long": "name-or-id", - "help": "A name or id to use when selecting BGP port settings" + "help": "A name or id to use when selecting BGP port settings", + "required": true } ] }, @@ -3234,7 +3383,8 @@ "args": [ { "long": "name-or-id", - "help": "A name or id to use when selecting BGP port settings" + "help": "A name or id to use when selecting BGP port settings", + "required": true } ] } @@ -3280,7 +3430,8 @@ "args": [ { "long": "name-or-id", - "help": "A name or id to use when selecting BGP config." + "help": "A name or id to use when selecting BGP config.", + "required": true } ] }, @@ -3314,7 +3465,8 @@ "args": [ { "long": "asn", - "help": "The ASN to filter on. Required." + "help": "The ASN to filter on. Required.", + "required": true } ] }, @@ -3327,7 +3479,8 @@ "args": [ { "long": "asn", - "help": "The ASN to filter on. Required." + "help": "The ASN to filter on. Required.", + "required": true } ] } @@ -3390,19 +3543,23 @@ "args": [ { "long": "address", - "help": "The IP address and subnet mask to use when selecting the loopback address." + "help": "The IP address and subnet mask to use when selecting the loopback address.", + "required": true }, { "long": "rack-id", - "help": "The rack to use when selecting the loopback address." + "help": "The rack to use when selecting the loopback address.", + "required": true }, { "long": "subnet-mask", - "help": "The IP address and subnet mask to use when selecting the loopback address." + "help": "The IP address and subnet mask to use when selecting the loopback address.", + "required": true }, { "long": "switch-location", - "help": "The switch location to use when selecting the loopback address." + "help": "The switch location to use when selecting the loopback address.", + "required": true } ] }, @@ -3436,7 +3593,8 @@ }, { "long": "json-body", - "help": "Path to a file that contains the full json body." + "help": "Path to a file that contains the full json body.", + "required": true }, { "long": "json-body-template", @@ -3485,7 +3643,8 @@ "args": [ { "long": "port", - "help": "A name or id to use when selecting switch port settings info objects." + "help": "A name or id to use when selecting switch port settings info objects.", + "required": true } ] } @@ -3502,7 +3661,8 @@ "args": [ { "long": "json-body", - "help": "Path to a file that contains the full json body." + "help": "Path to a file that contains the full json body.", + "required": true }, { "long": "json-body-template", @@ -3580,7 +3740,8 @@ }, { "long": "project", - "help": "Name or ID of the project" + "help": "Name or ID of the project", + "required": true } ] }, @@ -3594,7 +3755,8 @@ }, { "long": "vpc", - "help": "Name or ID of the VPC" + "help": "Name or ID of the VPC", + "required": true } ] }, @@ -3607,7 +3769,8 @@ "args": [ { "long": "json-body", - "help": "Path to a file that contains the full json body." + "help": "Path to a file that contains the full json body.", + "required": true }, { "long": "json-body-template", @@ -3619,7 +3782,8 @@ }, { "long": "vpc", - "help": "Name or ID of the VPC" + "help": "Name or ID of the VPC", + "required": true } ] }, @@ -3633,7 +3797,8 @@ }, { "long": "vpc", - "help": "Name or ID of the VPC" + "help": "Name or ID of the VPC", + "required": true } ] } @@ -3649,7 +3814,8 @@ }, { "long": "project", - "help": "Name or ID of the project" + "help": "Name or ID of the project", + "required": true }, { "long": "sort-by", @@ -3696,7 +3862,8 @@ }, { "long": "vpc", - "help": "Name or ID of the VPC" + "help": "Name or ID of the VPC", + "required": true } ] }, @@ -3710,7 +3877,8 @@ }, { "long": "subnet", - "help": "Name or ID of the subnet" + "help": "Name or ID of the subnet", + "required": true }, { "long": "vpc", @@ -3740,7 +3908,8 @@ }, { "long": "vpc", - "help": "Name or ID of the VPC" + "help": "Name or ID of the VPC", + "required": true } ] }, @@ -3769,7 +3938,8 @@ }, { "long": "subnet", - "help": "Name or ID of the subnet" + "help": "Name or ID of the subnet", + "required": true }, { "long": "vpc", @@ -3803,7 +3973,8 @@ }, { "long": "subnet", - "help": "Name or ID of the subnet" + "help": "Name or ID of the subnet", + "required": true }, { "long": "vpc", @@ -3821,7 +3992,8 @@ }, { "long": "subnet", - "help": "Name or ID of the subnet" + "help": "Name or ID of the subnet", + "required": true }, { "long": "vpc", @@ -3858,7 +4030,8 @@ }, { "long": "vpc", - "help": "Name or ID of the VPC" + "help": "Name or ID of the VPC", + "required": true } ] }, @@ -3872,7 +4045,8 @@ }, { "long": "vpc", - "help": "Name or ID of the VPC" + "help": "Name or ID of the VPC", + "required": true } ] } diff --git a/cli/src/cmd_docs.rs b/cli/src/cmd_docs.rs index 29b6b6d5..f76a4dff 100644 --- a/cli/src/cmd_docs.rs +++ b/cli/src/cmd_docs.rs @@ -30,6 +30,13 @@ pub struct JsonArg { values: Vec, #[serde(skip_serializing_if = "Option::is_none")] help: Option, + #[serde(skip_serializing_if = "is_false")] + required: bool, +} + +// we love macros don't we folks +fn is_false(value: &bool) -> bool { + !*value } /// CLI docs in JSON format @@ -68,6 +75,7 @@ fn to_json(cmd: &Command) -> JsonDoc { .map(|value| value.get_name().to_string()) .collect(), help: arg.get_help().map(ToString::to_string), + required: arg.is_required_set(), }) .collect::>(); args.sort_unstable();